diff options
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r-- | networking/udhcp/files.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index f3899711c..9d5633b75 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -96,7 +96,7 @@ static void attach_option(struct option_set **opt_list, | |||
96 | 96 | ||
97 | existing = find_option(*opt_list, option->code); | 97 | existing = find_option(*opt_list, option->code); |
98 | if (!existing) { | 98 | if (!existing) { |
99 | DEBUG("Attaching option %02x to list", option->code); | 99 | log2("Attaching option %02x to list", option->code); |
100 | 100 | ||
101 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 101 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
102 | if ((option->flags & TYPE_MASK) == OPTION_STR1035) | 102 | if ((option->flags & TYPE_MASK) == OPTION_STR1035) |
@@ -125,7 +125,7 @@ static void attach_option(struct option_set **opt_list, | |||
125 | } | 125 | } |
126 | 126 | ||
127 | /* add it to an existing option */ | 127 | /* add it to an existing option */ |
128 | DEBUG("Attaching option %02x to existing member of list", option->code); | 128 | log1("Attaching option %02x to existing member of list", option->code); |
129 | if (option->flags & OPTION_LIST) { | 129 | if (option->flags & OPTION_LIST) { |
130 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 130 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
131 | if ((option->flags & TYPE_MASK) == OPTION_STR1035) | 131 | if ((option->flags & TYPE_MASK) == OPTION_STR1035) |
@@ -393,7 +393,9 @@ void FAST_FUNC read_leases(const char *file) | |||
393 | struct dhcpOfferedAddr lease; | 393 | struct dhcpOfferedAddr lease; |
394 | int64_t written_at, time_passed; | 394 | int64_t written_at, time_passed; |
395 | int fd; | 395 | int fd; |
396 | IF_UDHCP_DEBUG(unsigned i;) | 396 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 |
397 | unsigned i = 0; | ||
398 | #endif | ||
397 | 399 | ||
398 | fd = open_or_warn(file, O_RDONLY); | 400 | fd = open_or_warn(file, O_RDONLY); |
399 | if (fd < 0) | 401 | if (fd < 0) |
@@ -409,9 +411,8 @@ void FAST_FUNC read_leases(const char *file) | |||
409 | if ((uint64_t)time_passed > 12 * 60 * 60) | 411 | if ((uint64_t)time_passed > 12 * 60 * 60) |
410 | goto ret; | 412 | goto ret; |
411 | 413 | ||
412 | IF_UDHCP_DEBUG(i = 0;) | ||
413 | while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) { | 414 | while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) { |
414 | /* ADDME: what if it matches some static lease? */ | 415 | //FIXME: what if it matches some static lease? |
415 | uint32_t y = ntohl(lease.lease_nip); | 416 | uint32_t y = ntohl(lease.lease_nip); |
416 | if (y >= server_config.start_ip && y <= server_config.end_ip) { | 417 | if (y >= server_config.start_ip && y <= server_config.end_ip) { |
417 | signed_leasetime_t expires = ntohl(lease.expires) - (signed_leasetime_t)time_passed; | 418 | signed_leasetime_t expires = ntohl(lease.expires) - (signed_leasetime_t)time_passed; |
@@ -423,10 +424,12 @@ void FAST_FUNC read_leases(const char *file) | |||
423 | bb_error_msg("too many leases while loading %s", file); | 424 | bb_error_msg("too many leases while loading %s", file); |
424 | break; | 425 | break; |
425 | } | 426 | } |
426 | IF_UDHCP_DEBUG(i++;) | 427 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 |
428 | i++; | ||
429 | #endif | ||
427 | } | 430 | } |
428 | } | 431 | } |
429 | DEBUG("Read %d leases", i); | 432 | log1("Read %d leases", i); |
430 | ret: | 433 | ret: |
431 | close(fd); | 434 | close(fd); |
432 | } | 435 | } |