* [PATCH] netlink: Allow NULL to be passed as addr parameter to nl_addr_get (again)
@ 2026-03-11 4:13 David Gibson
2026-03-11 21:12 ` Stefano Brivio
0 siblings, 1 reply; 2+ messages in thread
From: David Gibson @ 2026-03-11 4:13 UTC (permalink / raw)
To: passt-dev, Stefano Brivio; +Cc: Jon Maloy, David Gibson
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>
---
netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netlink.c b/netlink.c
index ee9a6b16..e07b47f4 100644
--- a/netlink.c
+++ b/netlink.c
@@ -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));
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] netlink: Allow NULL to be passed as addr parameter to nl_addr_get (again)
2026-03-11 4:13 [PATCH] netlink: Allow NULL to be passed as addr parameter to nl_addr_get (again) David Gibson
@ 2026-03-11 21:12 ` Stefano Brivio
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Brivio @ 2026-03-11 21:12 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev, Jon Maloy
On Wed, 11 Mar 2026 15:13:57 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> 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.
Ouch, sorry. I totally misinterpreted the check on 'addr' (my own
check, by the way) and suggested to Jon that it could be skipped.
> Fixes: 251e676bd0bf ("netlink: Return prefix length for IPv6 addresses in nl_addr_get()")
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
--
Stefano
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-11 21:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-11 4:13 [PATCH] netlink: Allow NULL to be passed as addr parameter to nl_addr_get (again) David Gibson
2026-03-11 21:12 ` Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).