From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Anshu Kumari <anskuma@redhat.com>,
passt-dev@passt.top, jmaloy@redhat.com, lvivier@redhat.com
Subject: Re: [PATCH v3 3/6] dhcp: Add option type table and value parser
Date: Fri, 12 Jun 2026 01:04:37 +0200 (CEST) [thread overview]
Message-ID: <20260612010436.6b25300f@elisabeth> (raw)
In-Reply-To: <ah4-s80eDM2i98bD@zatzit>
On Tue, 2 Jun 2026 12:23:47 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Mon, Jun 01, 2026 at 01:07:53PM +0530, Anshu Kumari wrote:
>
> > [...]
> >
> > +/**
> > + * dhcp_opt_types - Maps option code to RFC 2132 value type, indexed by code
> > + */
> > +static const enum dhcp_opt_type dhcp_opt_types[256] = {
> > + [1] = DHCP_OPT_IPV4, /* Subnet Mask */
> > + [2] = DHCP_OPT_INT32, /* Time Offset */
> > + [3] = DHCP_OPT_IPV4_LIST, /* Router */
>
> I'm still a bit unsure if we want to allow user modification of the
> options, like this one, which we already manage ourselves.
I think we don't lose any functionality if we allow users to overwrite
them, and we might gain some: for example one might want to directly
set a specific default route in the target network namespace, in pasta,
but change it as a DHCP client runs.
Not that I see any point in doing that, but it's harmless, so why not.
Maybe even just for testing, go figure.
> > [...]
> >
> > @@ -61,7 +227,15 @@ int dhcp_add_option(struct ctx *c, uint8_t code, const char *val_str)
> > c->custom_opts_count++;
> > }
> >
> > + ret = dhcp_opt_parse(code, val_str,
> > + c->custom_opts[idx].val,
> > + sizeof(c->custom_opts[0].val));
>
> Now that this parsing and adding code is all in dhcp.c, could we parse
> the options directly into the existing opts[] global, rather than
> requiring both the string and parsed forms in c->custom_opts?
I see one downside with that: the day we add the possibility for
pesto(1) to set and read out options, we would need to add an
implementation to decode them back, which could be rather complicated
if you think of stuff such as "compressed" (yes, that madness) domain
names.
--
Stefano
next prev parent reply other threads:[~2026-06-11 23:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 7:37 [PATCH v3 0/6] Add --dhcp-boot and --dhcp-opt options Anshu Kumari
2026-06-01 7:37 ` [PATCH v3 1/6] conf: Add --dhcp-opt command-line option Anshu Kumari
2026-06-02 2:00 ` David Gibson
2026-06-11 23:04 ` Stefano Brivio
2026-06-01 7:37 ` [PATCH v3 2/6] conf: Add --dhcp-boot " Anshu Kumari
2026-06-02 2:02 ` David Gibson
2026-06-11 23:05 ` Stefano Brivio
2026-06-01 7:37 ` [PATCH v3 3/6] dhcp: Add option type table and value parser Anshu Kumari
2026-06-02 2:23 ` David Gibson
2026-06-11 23:04 ` Stefano Brivio [this message]
2026-06-11 23:04 ` Stefano Brivio
2026-06-01 7:37 ` [PATCH v3 4/6] dhcp: Refactor fill_one() to operate on a generic buffer Anshu Kumari
2026-06-02 2:25 ` David Gibson
2026-06-01 7:37 ` [PATCH v3 5/6] dhcp: Add option overload Anshu Kumari
2026-06-02 2:50 ` David Gibson
2026-06-11 23:04 ` Stefano Brivio
2026-06-01 7:37 ` [PATCH v3 6/6] doc: Add --dhcp-boot and --dhcp-opt to man page Anshu Kumari
2026-06-02 2:54 ` David Gibson
2026-06-11 23:05 ` Stefano Brivio
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=20260612010436.6b25300f@elisabeth \
--to=sbrivio@redhat.com \
--cc=anskuma@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=jmaloy@redhat.com \
--cc=lvivier@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).