diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2026-03-11 15:13:57 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-03-11 22:11:30 +0100 |
| commit | 831e98384b057a7e74aa615200752c1d84c017ee (patch) | |
| tree | 71cb07c3f666c9cf9ce86ac436416f62d766b1ec | |
| parent | 251e676bd0bffe0c3b8bf0e925fbc87b6d4eeb6a (diff) | |
| download | passt-831e98384b057a7e74aa615200752c1d84c017ee.tar passt-831e98384b057a7e74aa615200752c1d84c017ee.tar.gz passt-831e98384b057a7e74aa615200752c1d84c017ee.tar.bz2 passt-831e98384b057a7e74aa615200752c1d84c017ee.tar.lz passt-831e98384b057a7e74aa615200752c1d84c017ee.tar.xz passt-831e98384b057a7e74aa615200752c1d84c017ee.tar.zst passt-831e98384b057a7e74aa615200752c1d84c017ee.zip | |
netlink: Allow NULL to be passed as addr parameter to nl_addr_get (again)
A recent fix to nl_addr_get() unfortunately introduced a different problem.
251e676bd0bf removed a test if @addr was non-NULL. conf_ip6() relied on
being able to pass NULL in order to update the link-local address without
updating the main address (because it was already set by the user).
This means that 'pasta -a 2001:db8::1' will SEGV. Reverse the incorrect
part of the change to fix this.
Fixes: 251e676bd0bf ("netlink: Return prefix length for IPv6 addresses in nl_addr_get()")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | netlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -788,7 +788,7 @@ int nl_addr_get(int s, unsigned int ifi, sa_family_t af, (af == AF_INET6 && rta->rta_type != IFA_ADDRESS)) continue; - if (ifa->ifa_prefixlen > prefix_max && + if (ifa->ifa_prefixlen > prefix_max && addr && (af == AF_INET || ifa->ifa_scope < RT_SCOPE_LINK)) { memcpy(addr, RTA_DATA(rta), RTA_PAYLOAD(rta)); |
