udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files
Remove lots of unneeded #includes
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 @@
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)))
- {
+ if (!reservedIp(server_config.static_leases, htonl(addr))) {
- /* lease is not taken */
- ret = htonl(addr);
- if ((!(lease = find_lease_by_yiaddr(ret)) ||
+ /* lease is not taken */
+ ret = htonl(addr);
+ 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;
+ /* 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;
}