diff options
author | Glenn L McGrath | 2003-06-10 17:22:49 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-06-10 17:22:49 +0000 |
commit | 24833430bc2dbea733c3b0b9ea6c6b976f95474a (patch) | |
tree | 805a4197b8a0d36eaa6880dfc23d8c2539359fe9 /networking/udhcp/leases.c | |
parent | 6c43f743a3f607f91ee22a53db880fce2df645f0 (diff) | |
download | busybox-24833430bc2dbea733c3b0b9ea6c6b976f95474a.zip busybox-24833430bc2dbea733c3b0b9ea6c6b976f95474a.tar.gz |
Vodz, last_patch_88
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r-- | networking/udhcp/leases.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index 7ade91d..0b6b409 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c @@ -9,12 +9,12 @@ #include <netinet/in.h> #include <arpa/inet.h> -#include "debug.h" #include "dhcpd.h" #include "files.h" #include "options.h" -#include "leases.h" #include "arpping.h" +#include "common.h" + unsigned char blank_chaddr[] = {[0 ... 15] = 0}; @@ -102,6 +102,20 @@ struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr) } +/* check is an IP is taken, if it is, add it to the lease table */ +static int check_ip(u_int32_t addr) +{ + struct in_addr temp; + + if (arpping(addr, server_config.server, server_config.arp, server_config.interface) == 0) { + temp.s_addr = addr; + LOG(LOG_INFO, "%s belongs to someone, reserving it for %ld seconds", + inet_ntoa(temp), server_config.conflict_time); + add_lease(blank_chaddr, addr, server_config.conflict_time); + return 1; + } else return 0; +} + /* find an assignable address, it check_expired is true, we check all the expired leases as well. * Maybe this should try expired leases by age... */ u_int32_t find_address(int check_expired) @@ -133,19 +147,3 @@ u_int32_t find_address(int check_expired) } return 0; } - - -/* check is an IP is taken, if it is, add it to the lease table */ -int check_ip(u_int32_t addr) -{ - struct in_addr temp; - - if (arpping(addr, server_config.server, server_config.arp, server_config.interface) == 0) { - temp.s_addr = addr; - LOG(LOG_INFO, "%s belongs to someone, reserving it for %ld seconds", - inet_ntoa(temp), server_config.conflict_time); - add_lease(blank_chaddr, addr, server_config.conflict_time); - return 1; - } else return 0; -} - |