aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-02-02 01:16:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-02-02 01:16:08 +0000
commitc4d606e3678333fe07348904d1e2222cf43c5e31 (patch)
tree927d83d07d37b508ca6d507763c0dbbf0641ee5a
parentde55b5d014ac8800f0e7bfffa9a74d93beec28af (diff)
downloadbusybox-w32-c4d606e3678333fe07348904d1e2222cf43c5e31.tar.gz
busybox-w32-c4d606e3678333fe07348904d1e2222cf43c5e31.tar.bz2
busybox-w32-c4d606e3678333fe07348904d1e2222cf43c5e31.zip
udhcpd: allow "domain" to be a list of DNS servers, not just one
-rw-r--r--networking/udhcp/files.c32
-rw-r--r--networking/udhcp/options.c2
2 files changed, 21 insertions, 13 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 9ade4ae6d..775f829dd 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -101,19 +101,8 @@ static void attach_option(struct option_set **opt_list,
101{ 101{
102 struct option_set *existing, *new, **curr; 102 struct option_set *existing, *new, **curr;
103 103
104 /* add it to an existing option */
105 existing = find_option(*opt_list, option->code); 104 existing = find_option(*opt_list, option->code);
106 if (existing) { 105 if (!existing) {
107 DEBUG("Attaching option %s to existing member of list", option->name);
108 if (option->flags & OPTION_LIST) {
109 if (existing->data[OPT_LEN] + length <= 255) {
110 existing->data = realloc(existing->data,
111 existing->data[OPT_LEN] + length + 2);
112 memcpy(existing->data + existing->data[OPT_LEN] + 2, buffer, length);
113 existing->data[OPT_LEN] += length;
114 } /* else, ignore the data, we could put this in a second option in the future */
115 } /* else, ignore the new data */
116 } else {
117 DEBUG("Attaching option %s to list", option->name); 106 DEBUG("Attaching option %s to list", option->name);
118 107
119 /* make a new option */ 108 /* make a new option */
@@ -129,7 +118,26 @@ static void attach_option(struct option_set **opt_list,
129 118
130 new->next = *curr; 119 new->next = *curr;
131 *curr = new; 120 *curr = new;
121 return;
132 } 122 }
123
124 /* add it to an existing option */
125 DEBUG("Attaching option %s to existing member of list", option->name);
126 if (option->flags & OPTION_LIST) {
127 if (existing->data[OPT_LEN] + length <= 255) {
128 existing->data = xrealloc(existing->data,
129 existing->data[OPT_LEN] + length + 3);
130 if ((option->flags & TYPE_MASK) == OPTION_STRING) {
131 if (existing->data[OPT_LEN] + length >= 255)
132 return;
133 /* add space separator between STRING options in a list */
134 existing->data[existing->data[OPT_LEN] + 2] = ' ';
135 existing->data[OPT_LEN]++;
136 }
137 memcpy(existing->data + existing->data[OPT_LEN] + 2, buffer, length);
138 existing->data[OPT_LEN] += length;
139 } /* else, ignore the data, we could put this in a second option in the future */
140 } /* else, ignore the new data */
133} 141}
134 142
135 143
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 4a46da579..bda6efc7e 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -23,7 +23,7 @@ const struct dhcp_option dhcp_options[] = {
23 {"lprsvr", OPTION_IP | OPTION_LIST, 0x09}, 23 {"lprsvr", OPTION_IP | OPTION_LIST, 0x09},
24 {"hostname", OPTION_STRING | OPTION_REQ, 0x0c}, 24 {"hostname", OPTION_STRING | OPTION_REQ, 0x0c},
25 {"bootsize", OPTION_U16, 0x0d}, 25 {"bootsize", OPTION_U16, 0x0d},
26 {"domain", OPTION_STRING | OPTION_REQ, 0x0f}, 26 {"domain", OPTION_STRING | OPTION_LIST | OPTION_REQ, 0x0f},
27 {"swapsvr", OPTION_IP, 0x10}, 27 {"swapsvr", OPTION_IP, 0x10},
28 {"rootpath", OPTION_STRING, 0x11}, 28 {"rootpath", OPTION_STRING, 0x11},
29 {"ipttl", OPTION_U8, 0x17}, 29 {"ipttl", OPTION_U8, 0x17},