summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r--src/dhcpv4.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index 2b2f41e..3191ff2 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -37,6 +37,7 @@
#define PACKET_SIZE(start, end) (((uint8_t *)end - (uint8_t *)start) < DHCPV4_MIN_PACKET_SIZE ? \
DHCPV4_MIN_PACKET_SIZE : (uint8_t *)end - (uint8_t *)start)
+#define MAX_PREFIX_LEN 28
static void dhcpv4_netevent_cb(unsigned long event, struct netevent_handler_info *info);
static int setup_dhcpv4_addresses(struct interface *iface);
@@ -248,9 +249,9 @@ static int setup_dhcpv4_addresses(struct interface *iface)
}
}
- /* Don't allocate IP range for subnets bigger than 28 */
- if (iface->addr4[0].prefix > 28) {
- syslog(LOG_WARNING, "Auto allocation of DHCP range fails on %s", iface->name);
+ /* Don't allocate IP range for subnets smaller than /28 */
+ if (iface->addr4[0].prefix > MAX_PREFIX_LEN) {
+ syslog(LOG_WARNING, "Auto allocation of DHCP range fails on %s (prefix length must be < %d).", iface->name, MAX_PREFIX_LEN + 1);
return -1;
}