- spelling
[oweals/busybox.git] / networking / udhcp / leases.c
index d478880a30912dca95c114d6b68b95932df43888..bb08c3adbe7f7ea9d8cd5a197c8ad7e241c12b1f 100644 (file)
@@ -16,6 +16,8 @@
 #include "arpping.h"
 #include "common.h"
 
+#include "static_leases.h"
+
 
 uint8_t blank_chaddr[] = {[0 ... 15] = 0};
 
@@ -134,6 +136,10 @@ uint32_t find_address(int check_expired)
                /* ie, 192.168.55.255 */
                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)) ||
@@ -142,10 +148,11 @@ uint32_t find_address(int check_expired)
                     (check_expired  && lease_expired(lease))) &&
 
                     /* and it isn't on the network */
-                    !check_ip(ret)) {
+                    !check_ip(ret)) {
                        return ret;
                        break;
                }
        }
+       }
        return 0;
 }