From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ed+Qk/3G; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id DE00D5A026E for ; Sat, 17 Aug 2024 10:41:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723884109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a09UHFhwA18pUWlrRVV53GdM2nKOcJ+eIutXMh4C9Ys=; b=ed+Qk/3Gu7AN3epSAN4FfbnpK/KMJ/sZRTIGIkmhf2b/BqFf/ZQOWdd+ThixOsJXYLrYWq qN4ly2a7I1ZhkFyTfLjXeOKlz4TGksBou+3EORq3pMLYfKuNxGck+AJJ1WdJ2gqui/P062 TFKzPj9wd7+JLYPAX8xBrfdPjgIYhPI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-w5VjxZazMweBb4eLkIzeyw-1; Sat, 17 Aug 2024 04:41:48 -0400 X-MC-Unique: w5VjxZazMweBb4eLkIzeyw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-429097df54bso19565835e9.1 for ; Sat, 17 Aug 2024 01:41:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723884106; x=1724488906; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=a09UHFhwA18pUWlrRVV53GdM2nKOcJ+eIutXMh4C9Ys=; b=xPweEh0sbdZ/asRm6c6OzDdq4pXScmYc67C8WaX6ynbJpyqWgQopxgXvcXCvZtqehn GPZZoSq3ksVBcYBvXvbBovvPAqfCY8BWnzuRxKn+rw709KgCOAdp4W5u8HWrHdDzspat zgiByBdWe4O6R8rdKAkAgymgp2GzUSnmlkNr85nH503VhLRNj3r0METx915EeergOfwk 1lqTYAOA/eUd+HEnFPTdRUotWy/8Q8vhk2Ey3G5+3n5DyZUkyE9ppc73kkCjNnG223be BM8kMvSr0hsjNrE6omjRZdWnxKduc54y9JYatyreKyQTQk8/DbfqlwfC4WZjfjY3iqQy efCQ== X-Gm-Message-State: AOJu0Yx9YqdAEwnB5JgTcpwVO7YAF96+aFDWLLHsLA3DWDEUEaqji43m DjBLBMdmXx5VITBO27vrUXKOXDhxDgj7H85572gwwKtQGcD1G2EIQNCyBcZDSQHHSXFr937ukDE xiyxUjOBz/m3MQK7qXc51T+aaHzG9UTLYWmbn/6bdcsb8UrZLa1k32Ac7Gw== X-Received: by 2002:a7b:cd8f:0:b0:426:59ad:bbb3 with SMTP id 5b1f17b1804b1-429edf384b7mr33154455e9.32.1723884106273; Sat, 17 Aug 2024 01:41:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1E2ms6k7xfUcheymXs06LIl6F0P6HE4iWJOT5N3ffdI/2+yIHL+mEYPlKvCe5El3y3OE8wQ== X-Received: by 2002:a7b:cd8f:0:b0:426:59ad:bbb3 with SMTP id 5b1f17b1804b1-429edf384b7mr33154345e9.32.1723884105769; Sat, 17 Aug 2024 01:41:45 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded720fbsm98553845e9.35.2024.08.17.01.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2024 01:41:44 -0700 (PDT) Date: Sat, 17 Aug 2024 10:41:43 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 4/7] netlink, pasta: Disable DAD for link-local addresses on namespace interface Message-ID: <20240817104143.47d791c1@elisabeth> In-Reply-To: <20240817103716.10135435@elisabeth> References: <20240816073918.1483136-1-sbrivio@redhat.com> <20240816073918.1483136-5-sbrivio@redhat.com> <20240817103716.10135435@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: N5XIIRN2TDRLKQ7JZGCD2HNMCSS6LPEM X-Message-ID-Hash: N5XIIRN2TDRLKQ7JZGCD2HNMCSS6LPEM X-MailFrom: sbrivio@redhat.com 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, Paul Holzinger 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: On Sat, 17 Aug 2024 10:37:16 +0200 Stefano Brivio wrote: > On Sat, 17 Aug 2024 17:59:45 +1000 > David Gibson wrote: > > > On Fri, Aug 16, 2024 at 09:39:15AM +0200, Stefano Brivio wrote: > > > It makes no sense for a container or a guest to try and perform > > > duplicate address detection for their link-local address, as we'll > > > anyway not relay neighbour solicitations with an unspecified source > > > address. > > > > > > While they perform duplicate address detection, the link-local address > > > is not usable, which prevents us from bringing up especially > > > containers and communicate with them right away via IPv6. > > > > > > This is not enough to prevent DAD and reach the container right away: > > > we'll need a couple more patches. > > > > > > As we send NLM_F_REPLACE requests right away, while we still have to > > > read out other addresses on the same socket, we can't use nl_do(): > > > keep track of the last sequence we sent (last address we changed), and > > > deal with the answers to those NLM_F_REPLACE requests in a separate > > > loop, later. > > > > > > Link: https://github.com/containers/podman/pull/23561#discussion_r1711639663 > > > Signed-off-by: Stefano Brivio > > > --- > > > netlink.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > netlink.h | 1 + > > > pasta.c | 6 ++++++ > > > 3 files changed, 62 insertions(+) > > > > > > diff --git a/netlink.c b/netlink.c > > > index 873e6c7..59f2fd9 100644 > > > --- a/netlink.c > > > +++ b/netlink.c > > > @@ -673,6 +673,61 @@ int nl_route_dup(int s_src, unsigned int ifi_src, > > > return 0; > > > } > > > > > > +/** > > > + * nl_addr_set_ll_nodad() - Set IFA_F_NODAD on IPv6 link-local addresses > > > + * @s: Netlink socket > > > + * @ifi: Interface index in target namespace > > > + * > > > + * Return: 0 on success, negative error code on failure > > > + */ > > > +int nl_addr_set_ll_nodad(int s, unsigned int ifi) > > > +{ > > > + struct req_t { > > > + struct nlmsghdr nlh; > > > + struct ifaddrmsg ifa; > > > + } req = { > > > + .ifa.ifa_family = AF_INET6, > > > + .ifa.ifa_index = ifi, > > > + }; > > > + unsigned ll_addrs = 0; > > > + struct nlmsghdr *nh; > > > + char buf[NLBUFSIZ]; > > > + ssize_t status; > > > + uint32_t seq; > > > + > > > + seq = nl_send(s, &req, RTM_GETADDR, NLM_F_DUMP, sizeof(req)); > > > + nl_foreach_oftype(nh, status, s, buf, seq, RTM_NEWADDR) { > > > + struct ifaddrmsg *ifa = (struct ifaddrmsg *)NLMSG_DATA(nh); > > > + struct rtattr *rta; > > > + size_t na; > > > + > > > + if (ifa->ifa_index != ifi || ifa->ifa_scope != RT_SCOPE_LINK) > > > + continue; > > > + > > > + ifa->ifa_flags |= IFA_F_NODAD; > > > + > > > + for (rta = IFA_RTA(ifa), na = IFA_PAYLOAD(nh); RTA_OK(rta, na); > > > + rta = RTA_NEXT(rta, na)) { > > > + /* If 32-bit flags are used, add IFA_F_NODAD there */ > > > + if (rta->rta_type == IFA_FLAGS) > > > + *(uint32_t *)RTA_DATA(rta) |= IFA_F_NODAD; > > > + } > > > + > > > + nl_send(s, nh, RTM_NEWADDR, NLM_F_REPLACE, nh->nlmsg_len); > > > + ll_addrs++; > > > + } > > > > Uh.. did you forget to push an update. This looks like the last > > version. > > Worse :( I accidentally squashed the new changes into 5/7. 6/7, actually. -- Stefano