How to request more dhcp-options with udhcpc?
Denys Vlasenko
vda.linux at googlemail.com
Mon Dec 10 07:01:49 UTC 2007
On Friday 30 November 2007 05:01, Stefan Hellermann wrote:
> Denys Vlasenko schrieb:
> > On Thursday 29 November 2007 16:06, Stefan Hellermann wrote:
> >> Hello!
> >>
> >> I'm trying to get a NFS root-path in a initrd with busybox, but I have
> >> to change the source to select which DHCP-Options it fetches.
> >
> > Please be more specific.
>
> I have clients that use nfs-root and would like to get the NFS rootpath via
> DHCP. udhcpc is able to request the rootpath, but doesn't do it by default.
>
> >> Is there a way without changing networking/udhcp/options.c? Is it
> >> possible to create a config-option for custom dhcp-options or a
> >> runtime-switch? Or is there enough demand to fetch it by default?
> >
> > I think it is already there - "rootpath" environment variable should be
> > set and passed to script if option 17 (0x11) was in packet from DHCP
> > server.
>
> But usually a DHCP-client asks for a set of options and the DHCP-server
> only responds to the requested options. udhcpc request the following:
> subnet, router, dns, hostname, domain, broadcast, nisdomain, nissrv,
> ntpsrv. (networking/udhcpc/options.c)
>
> I need the DHCP-option rootpath too, so I have to patch the source:
>
> --- busybox-1.7.3/networking/udhcp/options.c 2007-09-03
> 13:48:26.000000000 +0200 +++ busybox-1.7.3_new/networking/udhcp/options.c
> 2007-11-30 13:31:46.000000000 +0100 @@ -25,7 +25,7 @@
> {"bootsize", OPTION_U16, 0x0d},
> {"domain", OPTION_STRING | OPTION_LIST | OPTION_REQ, 0x0f},
> {"swapsvr", OPTION_IP, 0x10},
> - {"rootpath", OPTION_STRING, 0x11},
> + {"rootpath", OPTION_STRING | OPTION_REQ, 0x11},
> {"ipttl", OPTION_U8, 0x17},
> {"mtu", OPTION_U16, 0x1a},
> {"broadcast", OPTION_IP | OPTION_REQ, 0x1c},
>
>
> ISCs DHCP could be configured to respond every time with a specific set of
> options, but then I would have to include every single option that some
> client sometimes need, also the dhcp-admin wouldn't really like such a
> change. It's much simpler to request the needed DHCP-options with udhcpc.
>
> If there's a runtime-switch you could easily request every DHCP-option you
> need, for example the mtu or the rootpath. Here's a patch against
> busybox-1.5.0 which adds this runtime-switch:
Applied with some changes, will be in 1.9.0. Thanks!
--
vda
More information about the busybox
mailing list