From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 79FD05A0265 for ; Wed, 04 Nov 2026 01:21:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793751682; 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=+AF1ZVJCQA9vWEQP/NLP9IF/HGU1DE4SY3kBwt5N4Lc=; b=IclPqiLJSgQrMEP6rhFa4kc7ZmbfAAJyYmK7EMABjZHQkzPurQbgKEgB3hZJf+jn1aZtpb v6HexXQxU/FNHfkdLnDrzwIuKDSSfxaGmmwgzB6GLeWXnLvvQWzet5+wELTdWxxFtnhKe5 rKiYN2NZWEuiNUSUbH25I0Hy9H6e6qg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-XrlUiLm9McuxVgs_RdV65A-1; Tue, 03 Nov 2026 19:21:21 -0500 X-MC-Unique: XrlUiLm9McuxVgs_RdV65A-1 X-Mimecast-MFC-AGG-ID: XrlUiLm9McuxVgs_RdV65A_1793751680 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a2063be141so1047805e9.1 for ; Tue, 03 Nov 2026 16:21:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793751680; x=1794356480; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=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hpb/f1oyja XNIkTQlGGUJv1JRVdhhPppfcRDkRdfa9i/hNxPMyy/uVXEl7vvk53mVCv/si+A/plFdNpIizy6L /kbki2Smgj X-Received: by 2002:a05:600c:3556:b0:4a7:6bc7:f778 with SMTP id 5b1f17b1804b1-4ac1932a355mr317028605e9.30.1793751679792; Tue, 03 Nov 2026 16:21:19 -0800 (PST) X-Received: by 2002:a05:600c:3556:b0:4a7:6bc7:f778 with SMTP id 5b1f17b1804b1-4ac1932a355mr317028385e9.30.1793751679222; Tue, 03 Nov 2026 16:21:19 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b452eb99b1sm4840695e9.3.2026.11.03.16.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 16:21:18 -0800 (PST) From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v14] passt, pasta: Introduce unified multi-address data structures Message-ID: <20261104012117.23942273@elisabeth> In-Reply-To: <20261102234906.1695438-1-jmaloy@redhat.com> References: <20261102234906.1695438-1-jmaloy@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 04 Nov 2026 01:21:17 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NwC4-dQKMzGIi-2tlzYTUjhheu2Om50nuQgEAbQ0d4o_1793751680 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 7I22KV6DFJ6RE3MXKZGHEZ43FJ7YN6YH X-Message-ID-Hash: 7I22KV6DFJ6RE3MXKZGHEZ43FJ7YN6YH 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: david@gibson.dropbear.id.au, 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: On Mon, 2 Nov 2026 18:49:06 -0500 Jon Maloy wrote: > [...] > > diff --git a/dhcpv6.c b/dhcpv6.c > index 29c7e320..80b76dde 100644 > --- a/dhcpv6.c > +++ b/dhcpv6.c > @@ -318,7 +318,7 @@ static bool dhcpv6_opt(struct iov_tail *data, uint16_t type) > * false otherwise and @data is unmodified > */ > static bool dhcpv6_ia_notonlink(struct iov_tail *data, > - struct in6_addr *la) > + const struct in6_addr *la) > { > int ia_types[2] = { OPT_IA_NA, OPT_IA_TA }; > struct opt_ia_addr opt_addr_storage; > @@ -567,6 +567,7 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, > struct opt_hdr client_id_storage; > /* cppcheck-suppress [variableScope,unmatchedSuppression] */ > struct opt_ia_na ia_storage; > + const struct guest_addr *a; > const struct in6_addr *src; > struct msg_hdr mh_storage; > const struct msg_hdr *mh; > @@ -574,6 +575,8 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, > const struct udphdr *uh; > size_t mlen, n; > > + a = fwd_get_addr(c, AF_INET6, true, CONF_ADDR_ANY); > + > uh = IOV_REMOVE_HEADER(data, uh_storage); > if (!uh) > return -1; > @@ -627,7 +630,7 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, > if (mh->type == TYPE_CONFIRM && server_id) > return -1; > > - if (dhcpv6_ia_notonlink(data, &c->ip6.addr)) { > + if (a && dhcpv6_ia_notonlink(data, &a->addr.a6)) { > > dhcpv6_send_ia_notonlink(c, saddr, data, > &client_id_base, > @@ -667,6 +670,15 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, > default: > return -1; > } > + > + /* If no address is available, drop all messages rather than sending a > + * bogus address. Information-request messages could ideally still be > + * answered, but since we unconditionally include an IA_NA option in all > + * replies (RFC 9915, Appendix B.), dropping them is safer. > + */ > + if (!a) > + return 1; Simpler and safer, at least for the moment, yes. On the other hand, couldn't you just do this at the beginning (when you assign 'a' from fwd_get_addr()), so that you don't need to modify the condition for dhcpv6_ia_notonlink(), as well as all the ones below: > + > if (ia) > resp.ia_na.iaid = ((struct opt_ia_na *)ia)->iaid; > > @@ -681,8 +693,11 @@ int dhcpv6(struct ctx *c, struct iov_tail *data, > > resp.hdr.xid = mh->xid; > > + if (a) > + resp.ia_addr.addr = a->addr.a6; > tap_udp6_send(c, src, 547, saddr, 546, mh->xid, &resp, n); > - c->ip6.addr_seen = c->ip6.addr; > + if (a) > + c->ip6.addr_seen = a->addr.a6; ...that is, those? They are already redundant (and Cppcheck reports it, by the way), but with an early return on (!a) at the beginning of the function it would become obvious. > > return 1; > } -- Stefano