From: Stefano Brivio <sbrivio@redhat.com>
To: Enrique Llorente Pastora <ellorent@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v11] dhcp, dhcpv6: Add hostname and client fqdn ops
Date: Tue, 11 Feb 2025 11:40:19 +0100 [thread overview]
Message-ID: <20250211114019.772f522a@elisabeth> (raw)
In-Reply-To: <CAHVoYmKk6f9igBEnRYspaS32dMW6TVFfSEBeka3Q_BybEJTBfw@mail.gmail.com>
On Tue, 11 Feb 2025 11:36:41 +0100
Enrique Llorente Pastora <ellorent@redhat.com> wrote:
> On Mon, Feb 10, 2025 at 7:15 PM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> > On Fri, 7 Feb 2025 12:36:55 +0100
> > Enrique Llorente <ellorent@redhat.com> wrote:
> >
> > > Both DHCPv4 and DHCPv6 has the capability to pass the hostname to
> > > clients, the DHCPv4 uses option 12 (hostname) while the DHCPv6 uses
> > option 39
> > > (client fqdn), for some virt deployments like kubevirt is expected to
> > > have the VirtualMachine name as the guest hostname.
> > >
> > > This change add the following arguments:
> > > - -H --hostname NAME to configure the hostname DHCPv4 option(12)
> > > - --fqdn NAME to configure client fqdn option for both DHCPv4(81) and
> > > DHCPv6(39)
> > >
> > > Signed-off-by: Enrique Llorente <ellorent@redhat.com>
> >
> > I tried to break it but this time my little hammer broke instead...
> >
> > Applied, thanks!
> >
> > I noticed one (pre-existing) issue:
> >
> > > +/* Total option size (excluding end option) is 576 (RFC 2131), minus
> > > + * offset of options (268), minus end option and its length (2).
> > > + */
> > > +#define OPT_MAX 306
> > > +
> > > /**
> > > * dhcp_init() - Initialise DHCP options
> > > */
> > > @@ -122,7 +127,7 @@ struct msg {
> > > uint8_t sname[64];
> > > uint8_t file[128];
> > > uint32_t magic;
> > > - uint8_t o[308];
> > > + uint8_t o[OPT_MAX + 2 /* End option and its length */ ];
> >
> > ...actually, option 255 is special in that it takes just one byte,
> > because it has no length byte.
> >
> > I just assumed things from my memory without re-reading the RFC, sorry
> > for that. That's RFC 2131, section 3.2.
> >
> > It's different from option 80, Rapid Commit, RFC 4039, which takes two
> > bytes (zero length, and one length byte).
> >
> > So we should change the two code lines above, and drop my stupid:
> >
> > m->o[offset++] = 0;
>
> And also change the "o" declaration as the following right ?
>
> uint8_t o[OPT_MAX + 1 /* End option */ ];
Yes. I haven't checked the rest.
> > It's harmless because padding is harmless (option 0, also without
> > length byte, taking one byte), but not needed, and we could stuff one
> > extra byte in the response.
>
> I will push a little follow up with these things.
Thanks!
--
Stefano
prev parent reply other threads:[~2025-02-11 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 11:36 [PATCH v11] dhcp, dhcpv6: Add hostname and client fqdn ops Enrique Llorente
2025-02-10 18:15 ` Stefano Brivio
[not found] ` <CAHVoYmKk6f9igBEnRYspaS32dMW6TVFfSEBeka3Q_BybEJTBfw@mail.gmail.com>
2025-02-11 10:40 ` 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=20250211114019.772f522a@elisabeth \
--to=sbrivio@redhat.com \
--cc=ellorent@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).