diff options
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index e8847ce..27c64a8 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -743,13 +743,19 @@ if (is_subsystem_dirty('staticmaps')) { $tab_array = array(); $tabscounter = 0; $i = 0; +$have_small_subnet = false; foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; /* Not static IPv4 or subnet >= 31 */ - if (!is_ipaddrv4($oc['ipaddr']) || - empty($oc['subnet']) || $oc['subnet'] >= 31) { + if ($oc['subnet'] >= 31) { + $have_small_subnet = true; + $example_name = $ifname; + $example_cidr = $oc['subnet']; + continue; + } + if (!is_ipaddrv4($oc['ipaddr']) || empty($oc['subnet'])) { continue; } @@ -764,7 +770,12 @@ foreach ($iflist as $ifent => $ifname) { } if ($tabscounter == 0) { - print_info_box(gettext("The DHCP Server can only be enabled on interfaces configured with a static IPv4 address. This system has none.")); + if ($have_small_subnet) { + $sentence2 = sprintf(gettext('%1$s has a CIDR mask of %2$s, which does not contain enough addresses.'), htmlspecialchars($example_name), htmlspecialchars($example_cidr)); + } else { + $sentence2 = gettext("This system has no interfaces configured with a static IPv4 address."); + } + print_info_box(gettext("The DHCP Server requires a static IPv4 subnet large enough to serve addresses to clients.") . " " . $sentence2); include("foot.inc"); exit; } |