diff options
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r-- | networking/udhcp/leases.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index f5113408b..2f7847d74 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -4,20 +4,8 @@ | |||
4 | * Russ Dill <Russ.Dill@asu.edu> July 2001 | 4 | * Russ Dill <Russ.Dill@asu.edu> July 2001 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <time.h> | ||
8 | #include <string.h> | ||
9 | #include <sys/socket.h> | ||
10 | #include <netinet/in.h> | ||
11 | #include <arpa/inet.h> | ||
12 | |||
13 | #include "dhcpd.h" | ||
14 | #include "files.h" | ||
15 | #include "options.h" | ||
16 | #include "leases.h" | ||
17 | #include "arpping.h" | ||
18 | #include "common.h" | 7 | #include "common.h" |
19 | 8 | #include "dhcpd.h" | |
20 | #include "static_leases.h" | ||
21 | 9 | ||
22 | 10 | ||
23 | uint8_t blank_chaddr[] = {[0 ... 15] = 0}; | 11 | uint8_t blank_chaddr[] = {[0 ... 15] = 0}; |
@@ -138,22 +126,20 @@ uint32_t find_address(int check_expired) | |||
138 | if ((addr & 0xFF) == 0xFF) continue; | 126 | if ((addr & 0xFF) == 0xFF) continue; |
139 | 127 | ||
140 | /* Only do if it isn't an assigned as a static lease */ | 128 | /* Only do if it isn't an assigned as a static lease */ |
141 | if(!reservedIp(server_config.static_leases, htonl(addr))) | 129 | if (!reservedIp(server_config.static_leases, htonl(addr))) { |
142 | { | 130 | |
143 | 131 | /* lease is not taken */ | |
144 | /* lease is not taken */ | 132 | ret = htonl(addr); |
145 | ret = htonl(addr); | 133 | lease = find_lease_by_yiaddr(ret); |
146 | if ((!(lease = find_lease_by_yiaddr(ret)) || | 134 | |
147 | 135 | /* no lease or it expired and we are checking for expired leases */ | |
148 | /* or it expired and we are checking for expired leases */ | 136 | if ( (!lease || (check_expired && lease_expired(lease))) |
149 | (check_expired && lease_expired(lease))) && | 137 | && /* and it isn't on the network */ !check_ip(ret) |
150 | 138 | ) { | |
151 | /* and it isn't on the network */ | 139 | return ret; |
152 | !check_ip(ret)) { | 140 | break; |
153 | return ret; | 141 | } |
154 | break; | ||
155 | } | 142 | } |
156 | } | 143 | } |
157 | } | ||
158 | return 0; | 144 | return 0; |
159 | } | 145 | } |