diff options
author | Dainis Jonitis <dainis.jonitis@ubnt.com> | 2018-11-26 14:53:51 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-05-03 14:51:52 +0200 |
commit | a17665eaabee92b04b947bb68b8717b18ace6615 (patch) | |
tree | 3e69ff22e02e580ec9478edb7bdb73e7670cefe5 | |
parent | 6b951c55b61c95ad485edd68762416b6c7d8178e (diff) |
dhcpv4: do not allow pool end address to overlap with broadcast address
Signed-off-by: Dainis Jonitis <dainis.jonitis@ubnt.com>
-rw-r--r-- | src/dhcpv4.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) | |