public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] netlink: Disable duplicate address detection for configured IPv6 address
@ 2022-10-10 23:33 Stefano Brivio
  2022-10-11  0:51 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2022-10-10 23:33 UTC (permalink / raw)
  To: passt-dev

With default options, when we pass --config-net, the IPv6 address is
actually going to be recycled from the init namespace, so it is in
fact duplicated, but duplicate address detection has no way to find
out.

With a different configured address, that's not the case, but anyway
duplicate address detection will be unable to see this.

In both cases, we're wasting time for nothing.

Pass the IFA_F_NODAD flag as we configure globally scoped IPv6
addresses via netlink.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 netlink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/netlink.c b/netlink.c
index 9719e91..6e5a96b 100644
--- a/netlink.c
+++ b/netlink.c
@@ -343,6 +343,9 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
 		if (af == AF_INET6) {
 			size_t rta_len = RTA_LENGTH(sizeof(req.set.a6.l));
 
+			/* By default, strictly speaking, it's duplicated */
+			req.ifa.ifa_flags = IFA_F_NODAD;
+
 			req.nlh.nlmsg_len = offsetof(struct req_t, set.a6)
 				+ sizeof(req.set.a6);
 
-- 
@@ -343,6 +343,9 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
 		if (af == AF_INET6) {
 			size_t rta_len = RTA_LENGTH(sizeof(req.set.a6.l));
 
+			/* By default, strictly speaking, it's duplicated */
+			req.ifa.ifa_flags = IFA_F_NODAD;
+
 			req.nlh.nlmsg_len = offsetof(struct req_t, set.a6)
 				+ sizeof(req.set.a6);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netlink: Disable duplicate address detection for configured IPv6 address
  2022-10-10 23:33 [PATCH] netlink: Disable duplicate address detection for configured IPv6 address Stefano Brivio
@ 2022-10-11  0:51 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2022-10-11  0:51 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

On Tue, Oct 11, 2022 at 01:33:08AM +0200, Stefano Brivio wrote:
> With default options, when we pass --config-net, the IPv6 address is
> actually going to be recycled from the init namespace, so it is in
> fact duplicated, but duplicate address detection has no way to find
> out.
> 
> With a different configured address, that's not the case, but anyway
> duplicate address detection will be unable to see this.
> 
> In both cases, we're wasting time for nothing.
> 
> Pass the IFA_F_NODAD flag as we configure globally scoped IPv6
> addresses via netlink.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  netlink.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/netlink.c b/netlink.c
> index 9719e91..6e5a96b 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -343,6 +343,9 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
>  		if (af == AF_INET6) {
>  			size_t rta_len = RTA_LENGTH(sizeof(req.set.a6.l));
>  
> +			/* By default, strictly speaking, it's duplicated */
> +			req.ifa.ifa_flags = IFA_F_NODAD;
> +
>  			req.nlh.nlmsg_len = offsetof(struct req_t, set.a6)
>  				+ sizeof(req.set.a6);
>  

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-11  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 23:33 [PATCH] netlink: Disable duplicate address detection for configured IPv6 address Stefano Brivio
2022-10-11  0:51 ` David Gibson

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).