Discussion:
How to request more dhcp-options with udhcpc?
Stefan Hellermann
2007-11-30 00:06:41 UTC
Permalink
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. 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 have a patch that adds a runtime-switch, but it is against an rather old
version of busybox, I could rebase it if there is demand for this.

Cheers,
Stefan Hellermann
Denys Vlasenko
2007-11-30 04:52:07 UTC
Permalink
Post by Stefan Hellermann
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.
Post by Stefan Hellermann
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.
--
vda
Stefan Hellermann
2007-11-30 13:01:28 UTC
Permalink
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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:

--- busybox-1.5.0/networking/udhcp/dhcpc.c 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/dhcpc.c 2007-06-02 21:15:34.000000000 +0200
@@ -126,7 +126,7 @@ int udhcpc_main(int argc, char *argv[]);
int udhcpc_main(int argc, char *argv[])
{
uint8_t *temp, *message;
- char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t;
+ char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t, *str_O;
unsigned long t1 = 0, t2 = 0, xid = 0;
unsigned long start = 0, lease = 0;
long now;
@@ -160,6 +160,7 @@ int udhcpc_main(int argc, char *argv[])
OPT_T = 1 << 15,
OPT_t = 1 << 16,
OPT_v = 1 << 17,
+ OPT_O = 1 << 18,
};
#if ENABLE_GETOPT_LONG
static const struct option arg_options[] = {
@@ -181,6 +182,7 @@ int udhcpc_main(int argc, char *argv[])
{ "timeout", required_argument, 0, 'T' },
{ "version", no_argument, 0, 'v' },
{ "retries", required_argument, 0, 't' },
+ { "request-option", required_argument, 0, 'O' },
{ 0, 0, 0, 0 }
};
#endif
@@ -196,10 +198,10 @@ int udhcpc_main(int argc, char *argv[])
#if ENABLE_GETOPT_LONG
applet_long_options = arg_options;
#endif
- opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
+ opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vO:",
&str_c, &str_V, &str_h, &str_h, &str_F,
&client_config.interface, &client_config.pidfile, &str_r,
- &client_config.script, &str_T, &str_t
+ &client_config.script, &str_T, &str_t, &str_O
);

if (opt & OPT_c)
@@ -245,6 +247,11 @@ int udhcpc_main(int argc, char *argv[])
printf("version %s\n\n", BB_VER);
return 0;
}
+ if (opt & OPT_O)
+ if (require_option(str_O)) {
+ printf("Option: %s unknown/not-supported\n", str_O);
+ return 1;
+ }

/* Start the log, sanitize fd's, and write a pid file */
udhcp_start_log_and_pid(client_config.pidfile);
--- busybox-1.5.0/networking/udhcp/options.c 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/options.c 2007-06-02 20:42:42.000000000 +0200
@@ -10,7 +10,7 @@


/* supported options are easily added here */
-const struct dhcp_option dhcp_options[] = {
+struct dhcp_option dhcp_options[] = {
/* name[12] flags code */
{"subnet", OPTION_IP | OPTION_REQ, 0x01},
{"timezone", OPTION_S32, 0x02},
@@ -67,7 +67,18 @@ const unsigned char option_lengths[] = {
[OPTION_S32] = 4
};

-
+/* find and mark requested item as required */
+int require_option(char *name)
+{
+ int i;
+ for (i = 0; dhcp_options[i].code; i++)
+ if( strcmp( name, dhcp_options[i].name ) == 0 ){
+ dhcp_options[i].flags |= OPTION_REQ;
+ return 0;
+ }
+ return 1;
+}
+
/* get an option with bounds checking (warning, not aligned). */
uint8_t *get_option(struct dhcpMessage *packet, int code)
{
--- busybox-1.5.0/networking/udhcp/options.h 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/options.h 2007-06-02 19:51:40.000000000 +0200
@@ -29,9 +29,10 @@ struct dhcp_option {
uint8_t code;
};

-extern const struct dhcp_option dhcp_options[];
+extern struct dhcp_option dhcp_options[];
extern const unsigned char option_lengths[];

+int require_option(char *name);
uint8_t *get_option(struct dhcpMessage *packet, int code);
int end_option(uint8_t *optionptr);
int add_option_string(uint8_t *optionptr, uint8_t *string);
--- busybox-1.5.0/include/usage.h 2007-03-22 21:21:35.000000000 +0100
+++ busybox-1.5.0_new/include/usage.h 2007-06-02 20:08:51.000000000 +0200
@@ -3410,7 +3410,7 @@
"Adjust filesystem options on ext[23] filesystems"

#define udhcpc_trivial_usage \
- "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
+ "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script] [-O dhcp-option]"
#define udhcpc_full_usage \
" -V,--vendorclass=CLASSID Set vendor class identifier\n" \
" -i,--interface=INTERFACE Interface to use (default: eth0)\n" \
@@ -3426,7 +3426,8 @@
" -n,--now Exit with failure if lease cannot be immediately negotiated\n" \
" -q,--quit Quit after obtaining lease\n" \
" -R,--release Release IP on quit\n" \
- " -v,--version Display version" \
+ " -v,--version Display version\n" \
+ " -O,--request-option=NAME Request NAME DHCP-Option" \

#define udhcpd_trivial_usage \
"[configfile]\n" \
Post by Denys Vlasenko
-- vda
Denys Vlasenko
2007-12-02 21:40:04 UTC
Permalink
Post by Stefan Hellermann
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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
subnet, router, dns, hostname, domain, broadcast, nisdomain, nissrv,
ntpsrv. (networking/udhcpc/options.c)
Thanks, will review it.
--
vda
Denys Vlasenko
2007-12-10 07:01:49 UTC
Permalink
Post by Stefan Hellermann
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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
subnet, router, dns, hostname, domain, broadcast, nisdomain, nissrv,
ntpsrv. (networking/udhcpc/options.c)
--- 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
{"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
Applied with some changes, will be in 1.9.0. Thanks!
--
vda
Denys Vlasenko
2007-12-02 21:40:04 UTC
Permalink
Post by Stefan Hellermann
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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
subnet, router, dns, hostname, domain, broadcast, nisdomain, nissrv,
ntpsrv. (networking/udhcpc/options.c)
Thanks, will review it.
--
vda
Denys Vlasenko
2007-12-10 07:01:49 UTC
Permalink
Post by Stefan Hellermann
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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
subnet, router, dns, hostname, domain, broadcast, nisdomain, nissrv,
ntpsrv. (networking/udhcpc/options.c)
--- 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
{"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
Applied with some changes, will be in 1.9.0. Thanks!
--
vda

William Thompson
2007-11-30 12:38:34 UTC
Permalink
Post by Denys Vlasenko
Post by Stefan Hellermann
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 believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c

I myself would like this ability. I modified the source (and the
non-busybox udhcp) to request the SLP options some time ago.
Stefan Hellermann
2007-11-30 13:35:04 UTC
Permalink
Post by William Thompson
Post by Denys Vlasenko
Post by Stefan Hellermann
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 believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c
I don't need to add the DHCP option to udhcp/options.c, it's already there. But it's not
requested from the dhcp-server by default (simply adding " | OPTION_REQ" in
udhcpc/options.c helps here). I've tried to explain it in my other mail, too.
Post by William Thompson
I myself would like this ability. I modified the source (and the
non-busybox udhcp) to request the SLP options some time ago.
_______________________________________________
busybox mailing list
busybox at busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
William Thompson
2007-11-30 14:16:47 UTC
Permalink
Post by Stefan Hellermann
Post by William Thompson
I believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c
I don't need to add the DHCP option to udhcp/options.c, it's already there.
But it's not requested from the dhcp-server by default (simply adding " |
OPTION_REQ" in udhcpc/options.c helps here). I've tried to explain it in my
other mail, too.
I saw the patch. For me, the option was not available.

I think it would be nice to have an options file that the user can populate
(fallback to builtin if not available).
William Thompson
2007-11-30 14:16:47 UTC
Permalink
Post by Stefan Hellermann
Post by William Thompson
I believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c
I don't need to add the DHCP option to udhcp/options.c, it's already there.
But it's not requested from the dhcp-server by default (simply adding " |
OPTION_REQ" in udhcpc/options.c helps here). I've tried to explain it in my
other mail, too.
I saw the patch. For me, the option was not available.

I think it would be nice to have an options file that the user can populate
(fallback to builtin if not available).
Stefan Hellermann
2007-11-30 13:35:04 UTC
Permalink
Post by William Thompson
Post by Denys Vlasenko
Post by Stefan Hellermann
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 believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c
I don't need to add the DHCP option to udhcp/options.c, it's already there. But it's not
requested from the dhcp-server by default (simply adding " | OPTION_REQ" in
udhcpc/options.c helps here). I've tried to explain it in my other mail, too.
Post by William Thompson
I myself would like this ability. I modified the source (and the
non-busybox udhcp) to request the SLP options some time ago.
_______________________________________________
busybox mailing list
busybox at busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
Stefan Hellermann
2007-11-30 13:01:28 UTC
Permalink
Post by Denys Vlasenko
Post by Stefan Hellermann
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.
Post by Denys Vlasenko
Post by Stefan Hellermann
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:

--- busybox-1.5.0/networking/udhcp/dhcpc.c 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/dhcpc.c 2007-06-02 21:15:34.000000000 +0200
@@ -126,7 +126,7 @@ int udhcpc_main(int argc, char *argv[]);
int udhcpc_main(int argc, char *argv[])
{
uint8_t *temp, *message;
- char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t;
+ char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_t, *str_O;
unsigned long t1 = 0, t2 = 0, xid = 0;
unsigned long start = 0, lease = 0;
long now;
@@ -160,6 +160,7 @@ int udhcpc_main(int argc, char *argv[])
OPT_T = 1 << 15,
OPT_t = 1 << 16,
OPT_v = 1 << 17,
+ OPT_O = 1 << 18,
};
#if ENABLE_GETOPT_LONG
static const struct option arg_options[] = {
@@ -181,6 +182,7 @@ int udhcpc_main(int argc, char *argv[])
{ "timeout", required_argument, 0, 'T' },
{ "version", no_argument, 0, 'v' },
{ "retries", required_argument, 0, 't' },
+ { "request-option", required_argument, 0, 'O' },
{ 0, 0, 0, 0 }
};
#endif
@@ -196,10 +198,10 @@ int udhcpc_main(int argc, char *argv[])
#if ENABLE_GETOPT_LONG
applet_long_options = arg_options;
#endif
- opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
+ opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vO:",
&str_c, &str_V, &str_h, &str_h, &str_F,
&client_config.interface, &client_config.pidfile, &str_r,
- &client_config.script, &str_T, &str_t
+ &client_config.script, &str_T, &str_t, &str_O
);

if (opt & OPT_c)
@@ -245,6 +247,11 @@ int udhcpc_main(int argc, char *argv[])
printf("version %s\n\n", BB_VER);
return 0;
}
+ if (opt & OPT_O)
+ if (require_option(str_O)) {
+ printf("Option: %s unknown/not-supported\n", str_O);
+ return 1;
+ }

/* Start the log, sanitize fd's, and write a pid file */
udhcp_start_log_and_pid(client_config.pidfile);
--- busybox-1.5.0/networking/udhcp/options.c 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/options.c 2007-06-02 20:42:42.000000000 +0200
@@ -10,7 +10,7 @@


/* supported options are easily added here */
-const struct dhcp_option dhcp_options[] = {
+struct dhcp_option dhcp_options[] = {
/* name[12] flags code */
{"subnet", OPTION_IP | OPTION_REQ, 0x01},
{"timezone", OPTION_S32, 0x02},
@@ -67,7 +67,18 @@ const unsigned char option_lengths[] = {
[OPTION_S32] = 4
};

-
+/* find and mark requested item as required */
+int require_option(char *name)
+{
+ int i;
+ for (i = 0; dhcp_options[i].code; i++)
+ if( strcmp( name, dhcp_options[i].name ) == 0 ){
+ dhcp_options[i].flags |= OPTION_REQ;
+ return 0;
+ }
+ return 1;
+}
+
/* get an option with bounds checking (warning, not aligned). */
uint8_t *get_option(struct dhcpMessage *packet, int code)
{
--- busybox-1.5.0/networking/udhcp/options.h 2007-03-22 21:21:23.000000000 +0100
+++ busybox-1.5.0_new/networking/udhcp/options.h 2007-06-02 19:51:40.000000000 +0200
@@ -29,9 +29,10 @@ struct dhcp_option {
uint8_t code;
};

-extern const struct dhcp_option dhcp_options[];
+extern struct dhcp_option dhcp_options[];
extern const unsigned char option_lengths[];

+int require_option(char *name);
uint8_t *get_option(struct dhcpMessage *packet, int code);
int end_option(uint8_t *optionptr);
int add_option_string(uint8_t *optionptr, uint8_t *string);
--- busybox-1.5.0/include/usage.h 2007-03-22 21:21:35.000000000 +0100
+++ busybox-1.5.0_new/include/usage.h 2007-06-02 20:08:51.000000000 +0200
@@ -3410,7 +3410,7 @@
"Adjust filesystem options on ext[23] filesystems"

#define udhcpc_trivial_usage \
- "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
+ "[-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script] [-O dhcp-option]"
#define udhcpc_full_usage \
" -V,--vendorclass=CLASSID Set vendor class identifier\n" \
" -i,--interface=INTERFACE Interface to use (default: eth0)\n" \
@@ -3426,7 +3426,8 @@
" -n,--now Exit with failure if lease cannot be immediately negotiated\n" \
" -q,--quit Quit after obtaining lease\n" \
" -R,--release Release IP on quit\n" \
- " -v,--version Display version" \
+ " -v,--version Display version\n" \
+ " -O,--request-option=NAME Request NAME DHCP-Option" \

#define udhcpd_trivial_usage \
"[configfile]\n" \
Post by Denys Vlasenko
-- vda
William Thompson
2007-11-30 12:38:34 UTC
Permalink
Post by Denys Vlasenko
Post by Stefan Hellermann
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 believe he's asking for a configurable way to add DHCP options to
dhcp_options in udhcp/options.c

I myself would like this ability. I modified the source (and the
non-busybox udhcp) to request the SLP options some time ago.
Stefan Hellermann
2007-11-30 00:06:41 UTC
Permalink
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. 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 have a patch that adds a runtime-switch, but it is against an rather old
version of busybox, I could rebase it if there is demand for this.

Cheers,
Stefan Hellermann
Denys Vlasenko
2007-11-30 04:52:07 UTC
Permalink
Post by Stefan Hellermann
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.
Post by Stefan Hellermann
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.
--
vda
Loading...