From a17665eaabee92b04b947bb68b8717b18ace6615 Mon Sep 17 00:00:00 2001 From: Dainis Jonitis Date: Mon, 26 Nov 2018 14:53:51 +0200 Subject: [PATCH] dhcpv4: do not allow pool end address to overlap with broadcast address Signed-off-by: Dainis Jonitis --- src/dhcpv4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) | -- 2.25.1