diff options
-rw-r--r-- | networking/udhcp/dhcpd.h | 21 | ||||
-rw-r--r-- | networking/udhcp/files.c | 2 | ||||
-rw-r--r-- | networking/udhcp/static_leases.c | 16 |
3 files changed, 22 insertions, 17 deletions
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h index 42a4b2782..67cb78ce7 100644 --- a/networking/udhcp/dhcpd.h +++ b/networking/udhcp/dhcpd.h | |||
@@ -5,17 +5,14 @@ | |||
5 | 5 | ||
6 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | 6 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
7 | 7 | ||
8 | /************************************/ | 8 | /* Defaults you may want to tweak */ |
9 | /* Defaults _you_ may want to tweak */ | 9 | /* Default max_lease_sec */ |
10 | /************************************/ | 10 | #define LEASE_TIME (60*60*24 * 10) |
11 | 11 | #define LEASES_FILE CONFIG_DHCPD_LEASES_FILE | |
12 | /* the period of time the client is allowed to use that address */ | 12 | /* Where to find the DHCP server configuration file */ |
13 | #define LEASE_TIME (60*60*24*10) /* 10 days of seconds */ | ||
14 | #define LEASES_FILE CONFIG_DHCPD_LEASES_FILE | ||
15 | |||
16 | /* where to find the DHCP server configuration file */ | ||
17 | #define DHCPD_CONF_FILE "/etc/udhcpd.conf" | 13 | #define DHCPD_CONF_FILE "/etc/udhcpd.conf" |
18 | 14 | ||
15 | |||
19 | struct option_set { | 16 | struct option_set { |
20 | uint8_t *data; | 17 | uint8_t *data; |
21 | struct option_set *next; | 18 | struct option_set *next; |
@@ -119,7 +116,11 @@ uint32_t get_static_nip_by_mac(struct static_lease *st_lease, void *arg) FAST_FU | |||
119 | /* Check to see if an IP is reserved as a static IP */ | 116 | /* Check to see if an IP is reserved as a static IP */ |
120 | int is_nip_reserved(struct static_lease *st_lease, uint32_t nip) FAST_FUNC; | 117 | int is_nip_reserved(struct static_lease *st_lease, uint32_t nip) FAST_FUNC; |
121 | /* Print out static leases just to check what's going on (debug code) */ | 118 | /* Print out static leases just to check what's going on (debug code) */ |
122 | void print_static_leases(struct static_lease **st_lease_pp) FAST_FUNC; | 119 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2 |
120 | void log_static_leases(struct static_lease **st_lease_pp) FAST_FUNC; | ||
121 | #else | ||
122 | # define log_static_leases(st_lease_pp) ((void)0) | ||
123 | #endif | ||
123 | 124 | ||
124 | 125 | ||
125 | /*** serverpacket.h ***/ | 126 | /*** serverpacket.h ***/ |
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index c3cc2b0f5..35592153b 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -270,7 +270,7 @@ static int FAST_FUNC read_staticlease(const char *const_line, void *arg) | |||
270 | 270 | ||
271 | add_static_lease(arg, (uint8_t*) &mac_bytes, ip); | 271 | add_static_lease(arg, (uint8_t*) &mac_bytes, ip); |
272 | 272 | ||
273 | if (ENABLE_UDHCP_DEBUG) print_static_leases(arg); | 273 | log_static_leases(arg); |
274 | 274 | ||
275 | return 1; | 275 | return 1; |
276 | } | 276 | } |
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c index 7d1aa2f27..1887a8afd 100644 --- a/networking/udhcp/static_leases.c +++ b/networking/udhcp/static_leases.c | |||
@@ -57,19 +57,23 @@ int FAST_FUNC is_nip_reserved(struct static_lease *st_lease, uint32_t nip) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | #if ENABLE_UDHCP_DEBUG | 60 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2 |
61 | /* Print out static leases just to check what's going on */ | 61 | /* Print out static leases just to check what's going on */ |
62 | /* Takes the address of the pointer to the static_leases linked list */ | 62 | /* Takes the address of the pointer to the static_leases linked list */ |
63 | void FAST_FUNC print_static_leases(struct static_lease **st_lease_pp) | 63 | void FAST_FUNC log_static_leases(struct static_lease **st_lease_pp) |
64 | { | 64 | { |
65 | struct static_lease *cur = *st_lease_pp; | 65 | struct static_lease *cur; |
66 | 66 | ||
67 | if (dhcp_verbose < 2) | ||
68 | return; | ||
69 | |||
70 | cur = *st_lease_pp; | ||
67 | while (cur) { | 71 | while (cur) { |
68 | printf("PrintStaticLeases: lease mac: %02x:%02x:%02x:%02x:%02x:%02x\n", | 72 | bb_info_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x", |
69 | cur->mac[0], cur->mac[1], cur->mac[2], | 73 | cur->mac[0], cur->mac[1], cur->mac[2], |
70 | cur->mac[3], cur->mac[4], cur->mac[5] | 74 | cur->mac[3], cur->mac[4], cur->mac[5], |
75 | cur->nip | ||
71 | ); | 76 | ); |
72 | printf("PrintStaticLeases: lease ip: %x\n", cur->nip); | ||
73 | cur = cur->next; | 77 | cur = cur->next; |
74 | } | 78 | } |
75 | } | 79 | } |