From: Stefano Brivio <sbrivio@redhat.com>
To: Jon Maloy <jmaloy@redhat.com>
Cc: david@gibson.dropbear.id.au, passt-dev@passt.top
Subject: Re: [PATCH v13] passt, pasta: Introduce unified multi-address data structures
Date: Mon, 02 Nov 2026 01:58:45 +0100 (CET) [thread overview]
Message-ID: <20261102015844.5a1f3cc0@elisabeth> (raw)
In-Reply-To: <20261027231459.3461973-1-jmaloy@redhat.com>
On Tue, 27 Oct 2026 19:14:59 -0400
Jon Maloy <jmaloy@redhat.com> wrote:
> [...]
>
> +++ 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,14 @@ int dhcpv6(struct ctx *c, struct iov_tail *data,
> default:
> return -1;
> }
> +
> + /* No address: INFORMATION_REQUEST can still be answered. For other
Nit: it's called Information-request in the RFC (our define can't be
called that way, but this is a comment about the message type).
> + * types RFC 8415 requires a NoAddrsAvail reply, but silently dropping
Nit: RFC 8415 was obsoleted by RFC 9915.
> + * is acceptable here as this is a transient state.
> + */
> + if (!a && mh->type != TYPE_INFORMATION_REQUEST)
> + return 1;
Partially pre-existing problem with Information-request: we're always
including the IA_NA option, but we shouldn't, see Appendix B. of RFC
9915:
+=========+========+========+=====+=====+===+====+=====+=====+=====+
| | Client | Server |IA_NA|IA_PD|ORO|Pref|Elap.|Relay|Auth.|
| | ID | ID | | | | |Time |Msg. | |
+=========+========+========+=====+=====+===+====+=====+=====+=====+
[...]
+=========+--------+--------+-----+-----+---+----+-----+-----+-----+
| Inform. | * | (see | | | * | | * | | |
| | | note) | | | | | | | |
+=========+--------+--------+-----+-----+---+----+-----+-----+-----+
...making things conceptually worse, until this patch, the address in
the IA_NA option was always considered valid. Now we're sending an
option that shouldn't be there (pre-existing) with a previous address
that doesn't exist anymore (because it was set in resp.ia_na), if any,
and an all-zero address otherwise.
This new part of the old issue is just conceptual because we always have
an IPv6 address to offer if DHCPv6 is enabled, so in practice this
patch doesn't make things worse. Except for those two nits (which I
can fix on merge) I wouldn't see a problem merging the patch like this.
If we want to solve that issue before proceeding, though:
- DHCPv6 doesn't have padding options, so we can't just zero it out. We
would need to actually remove it
- to do so, instead of a pre-formed IA_NA option, we would need to do
something similar to what dhcpv6_dns_fill(), appending it only as
needed and increasing the size of the message ('n') as needed.
I haven't tried to do that. It doesn't look exceedingly complicated,
but, if you think it is, then let's merge it this way for the moment
being. Or maybe skip the Information-request reply if (!a), which should
be slightly better than the alternative. Let me know what you think.
--
Stefano
prev parent reply other threads:[~2026-11-02 0:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 23:14 Jon Maloy
2026-11-02 0:58 ` Stefano Brivio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102015844.5a1f3cc0@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=jmaloy@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).