isc-dhcp: allow suppression of default gateway

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville 2023-02-26 17:49:13 -07:00
parent 5a0f41556f
commit d2dd1bef71
1 changed files with 6 additions and 2 deletions

View File

@ -364,7 +364,9 @@ gen_dhcp_subnet() {
echo " default-lease-time $leasetime;"
echo " max-lease-time $leasetime;"
fi
echo " option routers $gateway;"
if [ "$defaultroute" -eq 1 ] ; then
echo " option routers $gateway;"
fi
echo " option domain-name-servers $DNS;"
config_list_foreach "$cfg" "routes" append_routes
config_list_foreach "$cfg" "dhcp_option" append_dhcp_options
@ -374,7 +376,7 @@ gen_dhcp_subnet() {
dhcpd_add() {
local cfg="$1" synthesize="$2"
local dhcp6range="::"
local dynamicdhcp end gateway ifname ignore leasetime limit net netmask
local dynamicdhcp defaultroute end gateway ifname ignore leasetime limit net netmask
local proto networkid start subnet
local IP NETMASK BROADCAST NETWORK PREFIX DNS START END
@ -404,6 +406,8 @@ dhcpd_add() {
config_get_bool dynamicdhcp "$cfg" "dynamicdhcp" 1
config_get_bool defaultroute "$cfg" "default_route" 1
dhcp_ifs="$dhcp_ifs $ifname"
eval "$(ipcalc.sh $subnet $start $limit)"