When we copy addresses from the host to the container in nl_addr_dup(), we copy all the address's attributes, including IFA_CACHEINFO, which controls the address's lifetime. If the host address is managed by, for example, DHCP, it will typically have a finite lifetime. When we copy that lifetime to the pasta container, that lifetime will remain, meaning the kernel will eventually remove the address, typically some hours later. The container, however, won't have the DHCP client or whatever was managing and maintaining the address in the host, so it will just lose connectivity. Long term, we may want to monitor host address changes and reflect them to the guest. But for now, we just want to take a snapshot of the host's address and set those in the container permanently. We can accomplish that by stripping off the IFA_CACHEINFO attribute as we copy addresses. Link: https://github.com/containers/podman/issues/19405 Link: https://bugs.passt.top/show_bug.cgi?id=70 Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- netlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netlink.c b/netlink.c index 69a5304..f55f2c3 100644 --- a/netlink.c +++ b/netlink.c @@ -679,7 +679,9 @@ int nl_addr_dup(int s_src, unsigned int ifi_src, for (rta = IFA_RTA(ifa), na = IFA_PAYLOAD(nh); RTA_OK(rta, na); rta = RTA_NEXT(rta, na)) { - if (rta->rta_type == IFA_LABEL) + /* Strip label and expiry (cacheinfo) information */ + if (rta->rta_type == IFA_LABEL || + rta->rta_type == IFA_CACHEINFO) rta->rta_type = IFA_UNSPEC; } -- 2.41.0