diff options
Diffstat (limited to 'networking/udhcp/static_leases.c')
-rw-r--r-- | networking/udhcp/static_leases.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c index b7f9e5c59..3be7a5228 100644 --- a/networking/udhcp/static_leases.c +++ b/networking/udhcp/static_leases.c | |||
@@ -9,39 +9,6 @@ | |||
9 | #include "common.h" | 9 | #include "common.h" |
10 | #include "dhcpd.h" | 10 | #include "dhcpd.h" |
11 | 11 | ||
12 | /* Takes the address of the pointer to the static_leases linked list, | ||
13 | * address to a 6 byte mac address, | ||
14 | * 4 byte IP address */ | ||
15 | void FAST_FUNC add_static_lease(struct static_lease **st_lease_pp, | ||
16 | uint8_t *mac, | ||
17 | uint32_t nip) | ||
18 | { | ||
19 | struct static_lease *st_lease; | ||
20 | |||
21 | /* Find the tail of the list */ | ||
22 | while ((st_lease = *st_lease_pp) != NULL) { | ||
23 | st_lease_pp = &st_lease->next; | ||
24 | } | ||
25 | |||
26 | /* Add new node */ | ||
27 | *st_lease_pp = st_lease = xzalloc(sizeof(*st_lease)); | ||
28 | memcpy(st_lease->mac, mac, 6); | ||
29 | st_lease->nip = nip; | ||
30 | /*st_lease->next = NULL;*/ | ||
31 | } | ||
32 | |||
33 | /* Find static lease IP by mac */ | ||
34 | uint32_t FAST_FUNC get_static_nip_by_mac(struct static_lease *st_lease, void *mac) | ||
35 | { | ||
36 | while (st_lease) { | ||
37 | if (memcmp(st_lease->mac, mac, 6) == 0) | ||
38 | return st_lease->nip; | ||
39 | st_lease = st_lease->next; | ||
40 | } | ||
41 | |||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | /* Check to see if an IP is reserved as a static IP */ | 12 | /* Check to see if an IP is reserved as a static IP */ |
46 | int FAST_FUNC is_nip_reserved(struct static_lease *st_lease, uint32_t nip) | 13 | int FAST_FUNC is_nip_reserved(struct static_lease *st_lease, uint32_t nip) |
47 | { | 14 | { |
@@ -53,25 +20,3 @@ int FAST_FUNC is_nip_reserved(struct static_lease *st_lease, uint32_t nip) | |||
53 | 20 | ||
54 | return 0; | 21 | return 0; |
55 | } | 22 | } |
56 | |||
57 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2 | ||
58 | /* Print out static leases just to check what's going on */ | ||
59 | /* Takes the address of the pointer to the static_leases linked list */ | ||
60 | void FAST_FUNC log_static_leases(struct static_lease **st_lease_pp) | ||
61 | { | ||
62 | struct static_lease *cur; | ||
63 | |||
64 | if (dhcp_verbose < 2) | ||
65 | return; | ||
66 | |||
67 | cur = *st_lease_pp; | ||
68 | while (cur) { | ||
69 | bb_error_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x", | ||
70 | cur->mac[0], cur->mac[1], cur->mac[2], | ||
71 | cur->mac[3], cur->mac[4], cur->mac[5], | ||
72 | cur->nip | ||
73 | ); | ||
74 | cur = cur->next; | ||
75 | } | ||
76 | } | ||
77 | #endif | ||