PATCH: udhcpd "option domain" multiple values
Gabriel L. Somlo
somlo at cmu.edu
Fri Jan 26 17:00:58 UTC 2007
Denis & All,
Whatever I specify as the value for "option domain" in udhcpd.conf
ends up being on the "search" line in my client's /etc/resolv.conf
As such, I discovered that specifying multiple values for
"option domain" doesn't work with udhcpd.
The following patch fixes that by making "domain" accept a list of
options, and by insuring that STRING type options with multiple values
end up being separated by spaces (instead of being cat-ed together).
Let me know what you think.
Thanks,
Gabriel
diff -NarU5 busybox-svn-17463.orig/networking/udhcp/files.c busybox-svn-17463/networking/udhcp/files.c
--- busybox-svn-17463.orig/networking/udhcp/files.c 2007-01-22 11:17:58.000000000 -0500
+++ busybox-svn-17463/networking/udhcp/files.c 2007-01-26 11:52:26.000000000 -0500
@@ -106,11 +106,16 @@
if (existing) {
DEBUG("Attaching option %s to existing member of list", option->name);
if (option->flags & OPTION_LIST) {
if (existing->data[OPT_LEN] + length <= 255) {
existing->data = realloc(existing->data,
- existing->data[OPT_LEN] + length + 2);
+ existing->data[OPT_LEN] + length + 3);
+ if ((option->flags & TYPE_MASK) == OPTION_STRING) {
+ /* add space separator between STRING options in a list */
+ *(existing->data + existing->data[OPT_LEN] + 2) = ' ';
+ existing->data[OPT_LEN]++;
+ }
memcpy(existing->data + existing->data[OPT_LEN] + 2, buffer, length);
existing->data[OPT_LEN] += length;
} /* else, ignore the data, we could put this in a second option in the future */
} /* else, ignore the new data */
} else {
diff -NarU5 busybox-svn-17463.orig/networking/udhcp/options.c busybox-svn-17463/networking/udhcp/options.c
--- busybox-svn-17463.orig/networking/udhcp/options.c 2007-01-22 11:17:58.000000000 -0500
+++ busybox-svn-17463/networking/udhcp/options.c 2007-01-25 17:21:41.000000000 -0500
@@ -21,11 +21,11 @@
{"logsvr", OPTION_IP | OPTION_LIST, 0x07},
{"cookiesvr", OPTION_IP | OPTION_LIST, 0x08},
{"lprsvr", OPTION_IP | OPTION_LIST, 0x09},
{"hostname", OPTION_STRING | OPTION_REQ, 0x0c},
{"bootsize", OPTION_U16, 0x0d},
- {"domain", OPTION_STRING | OPTION_REQ, 0x0f},
+ {"domain", OPTION_STRING | OPTION_LIST | OPTION_REQ, 0x0f},
{"swapsvr", OPTION_IP, 0x10},
{"rootpath", OPTION_STRING, 0x11},
{"ipttl", OPTION_U8, 0x17},
{"mtu", OPTION_U16, 0x1a},
{"broadcast", OPTION_IP | OPTION_REQ, 0x1c},
More information about the busybox
mailing list