diff options
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r-- | networking/udhcp/leases.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index 81acb9910..4999d8079 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -1,15 +1,12 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * leases.c -- tools to manage DHCP leases | ||
4 | * Russ Dill <Russ.Dill@asu.edu> July 2001 | 3 | * Russ Dill <Russ.Dill@asu.edu> July 2001 |
5 | * | 4 | * |
6 | * Licensed under GPLv2, see file LICENSE in this tarball for details. | 5 | * Licensed under GPLv2, see file LICENSE in this tarball for details. |
7 | */ | 6 | */ |
8 | |||
9 | #include "common.h" | 7 | #include "common.h" |
10 | #include "dhcpd.h" | 8 | #include "dhcpd.h" |
11 | 9 | ||
12 | |||
13 | /* Find the oldest expired lease, NULL if there are no expired leases */ | 10 | /* Find the oldest expired lease, NULL if there are no expired leases */ |
14 | static struct dyn_lease *oldest_expired_lease(void) | 11 | static struct dyn_lease *oldest_expired_lease(void) |
15 | { | 12 | { |
@@ -28,7 +25,6 @@ static struct dyn_lease *oldest_expired_lease(void) | |||
28 | return oldest_lease; | 25 | return oldest_lease; |
29 | } | 26 | } |
30 | 27 | ||
31 | |||
32 | /* Clear out all leases with matching nonzero chaddr OR yiaddr. | 28 | /* Clear out all leases with matching nonzero chaddr OR yiaddr. |
33 | * If chaddr == NULL, this is a conflict lease. | 29 | * If chaddr == NULL, this is a conflict lease. |
34 | */ | 30 | */ |
@@ -45,8 +41,7 @@ static void clear_leases(const uint8_t *chaddr, uint32_t yiaddr) | |||
45 | } | 41 | } |
46 | } | 42 | } |
47 | 43 | ||
48 | 44 | /* Add a lease into the table, clearing out any old ones. | |
49 | /* Add a lease into the table, clearing out any old ones | ||
50 | * If chaddr == NULL, this is a conflict lease. | 45 | * If chaddr == NULL, this is a conflict lease. |
51 | */ | 46 | */ |
52 | struct dyn_lease* FAST_FUNC add_lease( | 47 | struct dyn_lease* FAST_FUNC add_lease( |
@@ -84,14 +79,12 @@ struct dyn_lease* FAST_FUNC add_lease( | |||
84 | return oldest; | 79 | return oldest; |
85 | } | 80 | } |
86 | 81 | ||
87 | |||
88 | /* True if a lease has expired */ | 82 | /* True if a lease has expired */ |
89 | int FAST_FUNC is_expired_lease(struct dyn_lease *lease) | 83 | int FAST_FUNC is_expired_lease(struct dyn_lease *lease) |
90 | { | 84 | { |
91 | return (lease->expires < (leasetime_t) time(NULL)); | 85 | return (lease->expires < (leasetime_t) time(NULL)); |
92 | } | 86 | } |
93 | 87 | ||
94 | |||
95 | /* Find the first lease that matches MAC, NULL if no match */ | 88 | /* Find the first lease that matches MAC, NULL if no match */ |
96 | struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac) | 89 | struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac) |
97 | { | 90 | { |
@@ -104,7 +97,6 @@ struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac) | |||
104 | return NULL; | 97 | return NULL; |
105 | } | 98 | } |
106 | 99 | ||
107 | |||
108 | /* Find the first lease that matches IP, NULL is no match */ | 100 | /* Find the first lease that matches IP, NULL is no match */ |
109 | struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip) | 101 | struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip) |
110 | { | 102 | { |
@@ -117,7 +109,6 @@ struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip) | |||
117 | return NULL; | 109 | return NULL; |
118 | } | 110 | } |
119 | 111 | ||
120 | |||
121 | /* Check if the IP is taken; if it is, add it to the lease table */ | 112 | /* Check if the IP is taken; if it is, add it to the lease table */ |
122 | static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac) | 113 | static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac) |
123 | { | 114 | { |
@@ -138,7 +129,6 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac) | |||
138 | return 0; | 129 | return 0; |
139 | } | 130 | } |
140 | 131 | ||
141 | |||
142 | /* Find a new usable (we think) address */ | 132 | /* Find a new usable (we think) address */ |
143 | uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac) | 133 | uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac) |
144 | { | 134 | { |