* [PATCH] netlink: Set IFA_ADDRESS, not just IFA_LOCAL, while adding IPv4 addresses
@ 2023-08-23 7:38 Stefano Brivio
0 siblings, 0 replies; only message in thread
From: Stefano Brivio @ 2023-08-23 7:38 UTC (permalink / raw)
To: passt-dev; +Cc: David Gibson
Otherwise, we actually configure the address, but it's not usable
because no local route is added by the kernel.
Link: https://github.com/containers/podman/pull/19699
Fixes: cfe7509e5c16 ("netlink: Use struct in_addr for IPv4 addresses, not bare uint32_t")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
netlink.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/netlink.c b/netlink.c
index f55f2c3..7e9caf4 100644
--- a/netlink.c
+++ b/netlink.c
@@ -629,6 +629,7 @@ int nl_addr_set(int s, unsigned int ifi, sa_family_t af,
memcpy(&req.set.a4.l, addr, sizeof(req.set.a4.l));
req.set.a4.rta_l.rta_len = rta_len;
req.set.a4.rta_l.rta_type = IFA_LOCAL;
+ memcpy(&req.set.a4.a, addr, sizeof(req.set.a4.a));
req.set.a4.rta_a.rta_len = rta_len;
req.set.a4.rta_a.rta_type = IFA_ADDRESS;
}
--
@@ -629,6 +629,7 @@ int nl_addr_set(int s, unsigned int ifi, sa_family_t af,
memcpy(&req.set.a4.l, addr, sizeof(req.set.a4.l));
req.set.a4.rta_l.rta_len = rta_len;
req.set.a4.rta_l.rta_type = IFA_LOCAL;
+ memcpy(&req.set.a4.a, addr, sizeof(req.set.a4.a));
req.set.a4.rta_a.rta_len = rta_len;
req.set.a4.rta_a.rta_type = IFA_ADDRESS;
}
--
2.39.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-23 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 7:38 [PATCH] netlink: Set IFA_ADDRESS, not just IFA_LOCAL, while adding IPv4 addresses 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).