aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/options.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-06-17 11:57:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-06-17 11:57:09 +0200
commit31af3d5a1dbc750d8646f948ce642e6ae57ce880 (patch)
tree37d72b13f986b1da25def340771b49be4dd3028b /networking/udhcp/options.c
parentac906fa85e61b4e34161709de777616f858bc945 (diff)
downloadbusybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.gz
busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.bz2
busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.zip
udhcp: shorten mac len from 16 to 6 in lease file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/options.c')
-rw-r--r--networking/udhcp/options.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 7b80e6b28..b86b3135d 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -120,7 +120,7 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = {
120 120
121 121
122/* get an option with bounds checking (warning, result is not aligned). */ 122/* get an option with bounds checking (warning, result is not aligned). */
123uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code) 123uint8_t* FAST_FUNC get_option(struct dhcp_packet *packet, int code)
124{ 124{
125 uint8_t *optionptr; 125 uint8_t *optionptr;
126 int len; 126 int len;
@@ -159,15 +159,21 @@ uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code)
159 rem = sizeof(packet->sname); 159 rem = sizeof(packet->sname);
160 continue; 160 continue;
161 } 161 }
162 return NULL; 162 break;
163 } 163 }
164 len = 2 + optionptr[OPT_LEN]; 164 len = 2 + optionptr[OPT_LEN];
165 rem -= len; 165 rem -= len;
166 if (rem < 0) 166 if (rem < 0)
167 continue; /* complain and return NULL */ 167 continue; /* complain and return NULL */
168 168
169 if (optionptr[OPT_CODE] == code) 169 if (optionptr[OPT_CODE] == code) {
170#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2
171 char buf[256 * 2 + 2];
172 *bin2hex(buf, (void*) (optionptr + OPT_DATA), optionptr[OPT_LEN]) = '\0';
173 log2("Option 0x%02x found: %s", code, buf);
174#endif
170 return optionptr + OPT_DATA; 175 return optionptr + OPT_DATA;
176 }
171 177
172 if (optionptr[OPT_CODE] == DHCP_OPTION_OVERLOAD) { 178 if (optionptr[OPT_CODE] == DHCP_OPTION_OVERLOAD) {
173 overload |= optionptr[OPT_DATA]; 179 overload |= optionptr[OPT_DATA];
@@ -175,6 +181,9 @@ uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code)
175 } 181 }
176 optionptr += len; 182 optionptr += len;
177 } 183 }
184
185 /* log3 because udhcpc uses it a lot - very noisy */
186 log3("Option 0x%02x not found", code);
178 return NULL; 187 return NULL;
179} 188}
180 189