From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 334A65A0277 for ; Fri, 26 Apr 2024 04:01:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1714096870; bh=34LayzN3kUol/ohQoCoB71iGjtyCrrfohdThBwg1PkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KXjYviTabuInujsylFxBxY7ZoREaPfpaoxzGEYVSKE/5/L4S1TTGc5CXJ1dLP1IvN kdl2+6gtmoZOJfmh76oPDwphu5GfO4HY4QGW9BzH8nsY3Mbfqm9zWOkdQ9MKEC+RnE WO7+wddihfgSq5Os87zYK+fFD1zyzokuC3xLCzqBfbbWeZ3W/JImNYSzwP12b+R3U8 nCoJXcnxnjKlDFBdVjQrgtUtt+tj6hyeMJhjkcy2SQQtYRXVDwB482mcH5qlbhXTCj SBVNQHiQLQAAo6O16DruoH8HIsakc42Bht+yO1iLOBAL8lOncjb5n9Okv5xJqpTxqH 9UgD859YrgZMQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VQbYL4rw6z4wyh; Fri, 26 Apr 2024 12:01:10 +1000 (AEST) Date: Fri, 26 Apr 2024 11:13:44 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] netlink: Use IFA_F_NODAD also while duplicating addresses from the host Message-ID: References: <20240425221015.452760-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7biDhYMXsuDJAJgp" Content-Disposition: inline In-Reply-To: <20240425221015.452760-1-sbrivio@redhat.com> Message-ID-Hash: DPFG4GWXINRFHW2EG7P3I7WHEFSBRSBD X-Message-ID-Hash: DPFG4GWXINRFHW2EG7P3I7WHEFSBRSBD X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --7biDhYMXsuDJAJgp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2024 at 12:10:15AM +0200, Stefano Brivio wrote: > ...not just for a single set address (legacy operation with > --no-copy-addrs). I forgot to add this to nl_addr_dup(). >=20 > Note that we can have two version of flags: the 8-bit ifa_flags in > ifaddrmsg, and the newer 32-bit version as IFA_FLAGS attribute, which > is given priority if present. Make sure IFA_F_NODAD is set in both. >=20 > Without this, a Podman user reports, something on the lines of: > pasta --config-net -- ping -c1 -6 passt.top >=20 > would fail as the kernel would start Duplicate Address Detection > once we configure the address, which can't really work (and doesn't > make sense) in this case. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > netlink.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/netlink.c b/netlink.c > index 447fea2..b3897e6 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -804,6 +804,8 @@ int nl_addr_dup(int s_src, unsigned int ifi_src, > continue; > =20 > ifa->ifa_index =3D ifi_dst; > + /* Same as nl_addr_set(), but here it's more than a default */ > + ifa->ifa_flags |=3D IFA_F_NODAD; > =20 > for (rta =3D IFA_RTA(ifa), na =3D IFA_PAYLOAD(nh); RTA_OK(rta, na); > rta =3D RTA_NEXT(rta, na)) { > @@ -811,6 +813,10 @@ int nl_addr_dup(int s_src, unsigned int ifi_src, > if (rta->rta_type =3D=3D IFA_LABEL || > rta->rta_type =3D=3D IFA_CACHEINFO) > rta->rta_type =3D IFA_UNSPEC; > + > + /* If 32-bit flags are used, add IFA_F_NODAD there */ > + if (rta->rta_type =3D=3D IFA_FLAGS) > + *(uint32_t *)RTA_DATA(rta) |=3D IFA_F_NODAD; > } > =20 > rc =3D nl_do(s_dst, nh, RTM_NEWADDR, --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --7biDhYMXsuDJAJgp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmYq/8QACgkQzQJF27ox 2GfAKA/+O2lpJfvDUQW19wN39AZ+D4m471ZavsDNvsK0Om5AHOlhEQcawT2Nz4YR Begwo0F7h5zTo/oAqXmXbykA+46nGMxBhortRn96VJxXonzRleWUh8RcbCJT459p 8EsDbvtB3fylEHjn6w6q+JuLye6apSYwEXYLxOTy9D8JyVoB0JlxxmV/6Odsi0+j xMhwPJ9fNJw0uucwUnRiu/DnHQckal1zDMOfueX0TEWAYpVLtkTFv6ivjTalZ7AJ RSxJzBNcixlygTGdSyHOrDHYIUF5KFwcc+sx+tzChValdjJz/bY8DUgEMb4ok9TD ANoCekKYEmflXRUB7y21jlUOj1rKIMmp7fWC+Oime7xs2zfUS/w7lK6oehlM9oRc sn2ku8EmVsf5NI4GszgA2mzYBISp7X03Iv/31u2dgmyN1TdjxWGymjtU+rYwmHRP wMWx8yHiRn2sDR+8dE8BR4qkPB0GoeuINM+8zqMptIWgcl+iRArfjNS8mIXN3afW ALoi/KMfvu512LMVgkgcI+yz8vhf5dFsDEC+CNCWmjN0m9+qz81vZtbAc+d5UQjc Uj9VZWnhaYmp5TURG9rHiZEW25Q9QUdBDF4MY+xyv9kHuSXJe7zzJc2cTsyn4Jz9 V0hjU6CpD6QbPDkY382P5MeEcnX8dsmJpURYzWs80MPS8UJ/eUY= =NEhw -----END PGP SIGNATURE----- --7biDhYMXsuDJAJgp--