dhcpv4: fix manual dhcp-ranges
authorSteven Barth <steven@midlink.org>
Tue, 19 Aug 2014 05:37:17 +0000 (07:37 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 19 Aug 2014 05:37:17 +0000 (07:37 +0200)
src/dhcpv4.c

index 92a1397908c9b4e071b38759fa399f15436aa064..89750b23cbc3f73d77deed1b2ec35a2c5994beb8 100644 (file)
@@ -137,8 +137,8 @@ int setup_dhcpv4_interface(struct interface *iface, bool enable)
 
                        if (start && end && start < end &&
                                        start > ntohl(addr.s_addr & ~mask.s_addr) &&
-                                       (start & ntohl(mask.s_addr)) == start &&
-                                       (end & ntohl(mask.s_addr)) == end) {
+                                       (start & ntohl(~mask.s_addr)) == start &&
+                                       (end & ntohl(~mask.s_addr)) == end) {
                                iface->dhcpv4_start.s_addr = htonl(start) |
                                                (addr.s_addr & mask.s_addr);
                                iface->dhcpv4_end.s_addr = htonl(end) |