dhcpv4: fix static lease lookup
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 25 Feb 2019 09:46:18 +0000 (10:46 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 25 Feb 2019 09:48:25 +0000 (10:48 +0100)
Function config_find_lease_by_ip_addr expects IP address in network
byte order

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/dhcpv4.c

index ba64142e9746f0d9986383edbed28a422ae49f2f..ff2d8c2ed51342fdc0de134b95718dec6d715ae2 100644 (file)
@@ -944,7 +944,7 @@ raddr_out:
        for (uint32_t i = 0, try = (((uint32_t)rand()) % count) + start; i < count;
             ++i, try = (((try - start) + 1) % count) + start) {
 
-               if (config_find_lease_by_ipaddr(try))
+               if (config_find_lease_by_ipaddr(htonl(try)))
                        continue;
 
                if (list_empty(&iface->dhcpv4_assignments)) {