diff options
-rw-r--r-- | networking/udhcp/clientpacket.c | 6 | ||||
-rw-r--r-- | networking/udhcp/files.c | 2 | ||||
-rw-r--r-- | networking/udhcp/options.c | 8 | ||||
-rw-r--r-- | networking/udhcp/options.h | 2 | ||||
-rw-r--r-- | networking/udhcp/script.c | 15 |
5 files changed, 17 insertions, 16 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 7debac2ef..3ca579c4f 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -90,9 +90,9 @@ static void add_requests(struct dhcpMessage *packet) | |||
90 | int i, len = 0; | 90 | int i, len = 0; |
91 | 91 | ||
92 | packet->options[end + OPT_CODE] = DHCP_PARAM_REQ; | 92 | packet->options[end + OPT_CODE] = DHCP_PARAM_REQ; |
93 | for (i = 0; options[i].code; i++) | 93 | for (i = 0; dhcp_options[i].code; i++) |
94 | if (options[i].flags & OPTION_REQ) | 94 | if (dhcp_options[i].flags & OPTION_REQ) |
95 | packet->options[end + OPT_DATA + len++] = options[i].code; | 95 | packet->options[end + OPT_DATA + len++] = dhcp_options[i].code; |
96 | packet->options[end + OPT_LEN] = len; | 96 | packet->options[end + OPT_LEN] = len; |
97 | packet->options[end + OPT_DATA + len] = DHCP_END; | 97 | packet->options[end + OPT_DATA + len] = DHCP_END; |
98 | 98 | ||
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 3d0344b09..20761a585 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -82,7 +82,7 @@ static int read_opt(const char *const_line, void *arg) | |||
82 | 82 | ||
83 | if ((opt = strtok(strcpy(line, const_line), " \t="))) { | 83 | if ((opt = strtok(strcpy(line, const_line), " \t="))) { |
84 | 84 | ||
85 | for (option = options; option->code; option++) | 85 | for (option = dhcp_options; option->code; option++) |
86 | if (!strcasecmp(option->name, opt)) | 86 | if (!strcasecmp(option->name, opt)) |
87 | break; | 87 | break; |
88 | 88 | ||
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index a3edd0b8b..32deeabb3 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | 14 | ||
15 | /* supported options are easily added here */ | 15 | /* supported options are easily added here */ |
16 | struct dhcp_option options[] = { | 16 | struct dhcp_option dhcp_options[] = { |
17 | /* name[10] flags code */ | 17 | /* name[10] flags code */ |
18 | {"subnet", OPTION_IP | OPTION_REQ, 0x01}, | 18 | {"subnet", OPTION_IP | OPTION_REQ, 0x01}, |
19 | {"timezone", OPTION_S32, 0x02}, | 19 | {"timezone", OPTION_S32, 0x02}, |
@@ -158,9 +158,9 @@ int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t da | |||
158 | u16 = (u_int16_t *) &aligned; | 158 | u16 = (u_int16_t *) &aligned; |
159 | u32 = &aligned; | 159 | u32 = &aligned; |
160 | 160 | ||
161 | for (i = 0; options[i].code; i++) | 161 | for (i = 0; dhcp_options[i].code; i++) |
162 | if (options[i].code == code) { | 162 | if (dhcp_options[i].code == code) { |
163 | length = option_lengths[options[i].flags & TYPE_MASK]; | 163 | length = option_lengths[dhcp_options[i].flags & TYPE_MASK]; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (!length) { | 166 | if (!length) { |
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index 1fded2ef4..a62665801 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h | |||
@@ -27,7 +27,7 @@ struct dhcp_option { | |||
27 | unsigned char code; | 27 | unsigned char code; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | extern struct dhcp_option options[]; | 30 | extern struct dhcp_option dhcp_options[]; |
31 | extern int option_lengths[]; | 31 | extern int option_lengths[]; |
32 | 32 | ||
33 | unsigned char *get_option(struct dhcpMessage *packet, int code); | 33 | unsigned char *get_option(struct dhcpMessage *packet, int code); |
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c index 41b680d6b..7876dd3c7 100644 --- a/networking/udhcp/script.c +++ b/networking/udhcp/script.c | |||
@@ -160,8 +160,8 @@ static char **fill_envp(struct dhcpMessage *packet) | |||
160 | if (packet == NULL) | 160 | if (packet == NULL) |
161 | num_options = 0; | 161 | num_options = 0; |
162 | else { | 162 | else { |
163 | for (i = 0; options[i].code; i++) | 163 | for (i = 0; dhcp_options[i].code; i++) |
164 | if (get_option(packet, options[i].code)) | 164 | if (get_option(packet, dhcp_options[i].code)) |
165 | num_options++; | 165 | num_options++; |
166 | if (packet->siaddr) num_options++; | 166 | if (packet->siaddr) num_options++; |
167 | if ((temp = get_option(packet, DHCP_OPTION_OVER))) | 167 | if ((temp = get_option(packet, DHCP_OPTION_OVER))) |
@@ -184,14 +184,15 @@ static char **fill_envp(struct dhcpMessage *packet) | |||
184 | asprintip(&envp[j++], "ip=", (unsigned char *) &packet->yiaddr); | 184 | asprintip(&envp[j++], "ip=", (unsigned char *) &packet->yiaddr); |
185 | 185 | ||
186 | 186 | ||
187 | for (i = 0; options[i].code; i++) { | 187 | for (i = 0; dhcp_options[i].code; i++) { |
188 | if (!(temp = get_option(packet, options[i].code))) | 188 | if (!(temp = get_option(packet, dhcp_options[i].code))) |
189 | continue; | 189 | continue; |
190 | envp[j] = xmalloc(upper_length(temp[OPT_LEN - 2], options[i].flags & TYPE_MASK) + strlen(options[i].name) + 2); | 190 | envp[j] = xmalloc(upper_length(temp[OPT_LEN - 2], |
191 | fill_options(envp[j++], temp, &options[i]); | 191 | dhcp_options[i].flags & TYPE_MASK) + strlen(dhcp_options[i].name) + 2); |
192 | fill_options(envp[j++], temp, &dhcp_options[i]); | ||
192 | 193 | ||
193 | /* Fill in a subnet bits option for things like /24 */ | 194 | /* Fill in a subnet bits option for things like /24 */ |
194 | if (options[i].code == DHCP_SUBNET) { | 195 | if (dhcp_options[i].code == DHCP_SUBNET) { |
195 | memcpy(&subnet, temp, 4); | 196 | memcpy(&subnet, temp, 4); |
196 | asprintf(&envp[j++], "mask=%d", mton(&subnet)); | 197 | asprintf(&envp[j++], "mask=%d", mton(&subnet)); |
197 | } | 198 | } |