On Mon, 10 Feb 2025 at 12:32, Luca Boccassi <[email protected]> wrote:
>
> On Sun, 9 Feb 2025 at 15:52, Denys Vlasenko <[email protected]> wrote:
> >
> > On Tue, Aug 30, 2022 at 11:35 PM <[email protected]> wrote:
> > > From: Luca Boccassi <[email protected]>
> > >
> > > It is useful for applications to be able to query DHCP options
> > > without renewing IP address. Instead of a full DHCP handshake,
> > > using -I will cause a single DHCPINFORM packet to be sent, and
> > > the server response (including DHCP options received) to be
> > > printed and terminate. No configuration will be changed.
> > >
> > > This is useful for clients that want to query additional information
> > > from a server, that might not be normally processed, like custom
> > > server options. Also useful for checking specific options via -O.
> > >
> > > As per RFC 2131, allow targeting the already-known DHCP server via
> > > unicast instead of broadcast, via new -e option.
> > >
> > > Tested by running isc-dhcp-server with the following configuration:
> > >
> > > option domain-name "example.org";
> > > option domain-name-servers 1.1.1.1, 8.8.8.8;
> > > subnet 192.168.11.0 netmask 255.255.255.0 {
> > >   range 192.168.11.1 192.168.11.100;
> > >   authoritative;
> > >   option default-url "default.url";
> > > }
> > >
> > > $ busybox udhcpc -I -i host0 -O 114 -r 192.168.11.1
> > > udhcpc: started, v1.36.0.git
> > > udhcpc: broadcasting inform for 192.168.11.1, server 0.0.0.0
> > > udhcpc: lease of 0.0.0.0 obtained from 0.0.0.0, lease time 3600 (default)
> > > udhcpc: option: opt53=0x05
> > > udhcpc: option: serverid=192.168.11.101
> > > udhcpc: option: subnet=255.255.255.0
> > > udhcpc: option: dns=1.1.1.1 8.8.8.8
> > > udhcpc: option: domain=example.org
> > > udhcpc: option: opt114=0x64656661756c742e75726c
> > >
> > > $ busybox udhcpc -e 192.168.11.101 -I -i host0 -O 114 -r 192.168.11.1
> > > udhcpc: started, v1.36.0.git
> > > udhcpc: unicasting inform for 192.168.11.1, server 192.168.11.101
> > > udhcpc: lease of 0.0.0.0 obtained from 192.168.11.101, lease time 3600 
> > > (default)
> > > udhcpc: option: opt53=0x05
> > > udhcpc: option: serverid=192.168.11.101
> > > udhcpc: option: subnet=255.255.255.0
> > > udhcpc: option: dns=1.1.1.1 8.8.8.8
> > > udhcpc: option: domain=example.org
> > > udhcpc: option: opt114=0x64656661756c742e75726c
> >
> >
> > The use case is unclear. For the above examples,
> > how is this supposed to be used outside of manual debug runs
> > to see what server responds with?
> >
> > E.g. if used from a script or another tool:
> > * how -r IP_ADDR value is to be determined?
>
> As mentioned by Nicolas, the local ip address is already set when
> using this functionality. Either statically, or by earlier/separate
> DHCP client runs.
>
> > * are results meant to be parsed by looking at stderr??
>
> Yes at least for my use case, the requirement is to parse from the output.
>
> > Should we do it this/similar way for DHCPv4 too?
> > If not, why not, and what is the way which works for your use case?
>
> For my use case that doesn't work, because it implies running a full
> client. That's not what one needs typically in these use cases. You
> want to find auxiliary information, that might not be recorded or
> applied by the main client runs, for example auxiliary site-local
> options. The caller might not even be the normal dhcp client, but a
> separate and independent client trying to query the server for such
> information. So it cannot be part of the normal client main loop.
> Of course if someone needs that functionality, it's fine to add it as
> well, as a separate option.
>
> > For example:
> > ""We assume we have eth4 IP address (and routing and such) configured,
> > for example static configuration.
> > We run "udhcpc -I -i eth4 -O 114" to get option 114
> > ...periodically?
>
> That's one option, yes, in case the value of the option can change over time
>
> > ...once, in some post-address-configuration script?
>
> That also can work, also not in a post-script, but from another
> client, when it needs the site-local information.
>
> > ...how do you learn IP address of the DHCP server?
>
> Depends on the local topology, often it's the gateway address, so that
> can be used in such cases. If it's not known, the 'broadcast' option
> works - in that case you don't need to know the server address.

[re-sending from subscribed email address]
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to