From 31af3d5a1dbc750d8646f948ce642e6ae57ce880 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 17 Jun 2009 11:57:09 +0200 Subject: udhcp: shorten mac len from 16 to 6 in lease file Signed-off-by: Denys Vlasenko --- networking/udhcp/options.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'networking/udhcp/options.c') diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index 7b80e6b..b86b313 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c @@ -120,7 +120,7 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = { /* get an option with bounds checking (warning, result is not aligned). */ -uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code) +uint8_t* FAST_FUNC get_option(struct dhcp_packet *packet, int code) { uint8_t *optionptr; int len; @@ -159,15 +159,21 @@ uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code) rem = sizeof(packet->sname); continue; } - return NULL; + break; } len = 2 + optionptr[OPT_LEN]; rem -= len; if (rem < 0) continue; /* complain and return NULL */ - if (optionptr[OPT_CODE] == code) + if (optionptr[OPT_CODE] == code) { +#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2 + char buf[256 * 2 + 2]; + *bin2hex(buf, (void*) (optionptr + OPT_DATA), optionptr[OPT_LEN]) = '\0'; + log2("Option 0x%02x found: %s", code, buf); +#endif return optionptr + OPT_DATA; + } if (optionptr[OPT_CODE] == DHCP_OPTION_OVERLOAD) { overload |= optionptr[OPT_DATA]; @@ -175,6 +181,9 @@ uint8_t* FAST_FUNC get_option(struct dhcpMessage *packet, int code) } optionptr += len; } + + /* log3 because udhcpc uses it a lot - very noisy */ + log3("Option 0x%02x not found", code); return NULL; } -- cgit v1.1