From: Dainis Jonitis Date: Mon, 26 Nov 2018 12:53:51 +0000 (+0200) Subject: dhcpv4: do not allow pool end address to overlap with broadcast address X-Git-Url: http://git.openwrt.org/ubox.git?a=commitdiff_plain;h=a17665eaabee92b04b947bb68b8717b18ace6615;p=project%2Fodhcpd.git dhcpv4: do not allow pool end address to overlap with broadcast address Signed-off-by: Dainis Jonitis --- diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 679b793..b25046d 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -239,7 +239,8 @@ static int setup_dhcpv4_addresses(struct interface *iface) odhcpd_bitlen2netmask(false, iface->addr4[i].prefix, &mask); if ((start & ntohl(~mask.s_addr)) == start && - (end & ntohl(~mask.s_addr)) == end) { + (end & ntohl(~mask.s_addr)) == end && + end < ntohl(~mask.s_addr)) { /* Exclude broadcast address */ iface->dhcpv4_start_ip.s_addr = htonl(start) | (addr->s_addr & mask.s_addr); iface->dhcpv4_end_ip.s_addr = htonl(end) |