1
0
mirror of https://passt.top/passt synced 2024-12-22 05:35:23 +00:00

netlink: Set IFA_ADDRESS, not just IFA_LOCAL, while adding IPv4 addresses

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: cfe7509e5c ("netlink: Use struct in_addr for IPv4 addresses, not bare uint32_t")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2023-08-23 09:34:44 +02:00
parent 69303cafbe
commit 5e4f7b92b0

View File

@ -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;
}