diff options
author | Denis Vlasenko | 2006-11-18 19:51:32 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-11-18 19:51:32 +0000 |
commit | 5a3395bc01cd4b11309595a6ecdaf32f8279f378 (patch) | |
tree | 1e63aa591a05e9ec75aefdcd639ca4188e583648 /networking/udhcp/leases.c | |
parent | abfc4cf6d8b9c59724aceb70df5081a1368fdb62 (diff) | |
download | busybox-5a3395bc01cd4b11309595a6ecdaf32f8279f378.zip busybox-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.gz |
udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files
Remove lots of unneeded #includes
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 f511340..2f7847d 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c @@ -4,20 +4,8 @@ * Russ Dill <Russ.Dill@asu.edu> July 2001 */ -#include <time.h> -#include <string.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include "dhcpd.h" -#include "files.h" -#include "options.h" -#include "leases.h" -#include "arpping.h" #include "common.h" - -#include "static_leases.h" +#include "dhcpd.h" uint8_t blank_chaddr[] = {[0 ... 15] = 0}; @@ -138,22 +126,20 @@ uint32_t find_address(int check_expired) if ((addr & 0xFF) == 0xFF) continue; /* Only do if it isn't an assigned as a static lease */ - if(!reservedIp(server_config.static_leases, htonl(addr))) - { - - /* lease is not taken */ - ret = htonl(addr); - if ((!(lease = find_lease_by_yiaddr(ret)) || - - /* or it expired and we are checking for expired leases */ - (check_expired && lease_expired(lease))) && - - /* and it isn't on the network */ - !check_ip(ret)) { - return ret; - break; + if (!reservedIp(server_config.static_leases, htonl(addr))) { + + /* lease is not taken */ + ret = htonl(addr); + lease = find_lease_by_yiaddr(ret); + + /* no lease or it expired and we are checking for expired leases */ + if ( (!lease || (check_expired && lease_expired(lease))) + && /* and it isn't on the network */ !check_ip(ret) + ) { + return ret; + break; + } } } - } return 0; } |