diff --git a/ajax/networking/get_netcfg.php b/ajax/networking/get_netcfg.php
index 2dd330bb..7e7b8fa7 100644
--- a/ajax/networking/get_netcfg.php
+++ b/ajax/networking/get_netcfg.php
@@ -45,12 +45,14 @@ if (isset($interface)) {
preg_match('/static\srouters=(.*)/', $matched[0], $static_routers);
preg_match('/static\sdomain_name_server=(.*)/', $matched[0], $static_dns);
preg_match('/fallback\sstatic_'.$interface.'/', $matched[0], $fallback);
+ preg_match('/(?:no)?gateway/', $matched[0], $gateway);
$dhcpdata['Metric'] = $metric[1];
$dhcpdata['StaticIP'] = strpos($static_ip[1],'/') ? substr($static_ip[1], 0, strpos($static_ip[1],'/')) : $static_ip[1];
$dhcpdata['SubnetMask'] = cidr2mask($static_ip[1]);
$dhcpdata['StaticRouters'] = $static_routers[1];
$dhcpdata['StaticDNS'] = $static_dns[1];
$dhcpdata['FallbackEnabled'] = empty($fallback) ? false: true;
+ $dhcpdata['DefaultRoute'] = empty($gateway) || $gateway[0] == "gateway";
echo json_encode($dhcpdata);
}
diff --git a/app/js/custom.js b/app/js/custom.js
index 7a885472..13f0db92 100644
--- a/app/js/custom.js
+++ b/app/js/custom.js
@@ -186,6 +186,7 @@ function loadInterfaceDHCPSelect() {
$('#txtsubnetmask').val(jsonData.SubnetMask);
$('#txtgateway').val(jsonData.StaticRouters);
$('#chkfallback')[0].checked = jsonData.FallbackEnabled;
+ $('#default-route').prop('checked', jsonData.DefaultRoute);
$('#txtrangestart').val(jsonData.RangeStart);
$('#txtrangeend').val(jsonData.RangeEnd);
$('#txtrangeleasetime').val(jsonData.leaseTime);
diff --git a/includes/dhcp.php b/includes/dhcp.php
index bc323200..38d69ea5 100755
--- a/includes/dhcp.php
+++ b/includes/dhcp.php
@@ -244,6 +244,7 @@ function updateDHCPConfig($iface,$status)
$cfg[] = 'profile static_'.$iface;
$cfg[] = 'fallback static_'.$iface;
}
+ $cfg[] = $_POST['DefaultRoute'] == '1' ? 'gateway' : 'nogateway';
$dhcp_cfg = file_get_contents(RASPI_DHCPCD_CONFIG);
if (!preg_match('/^interface\s'.$iface.'$/m', $dhcp_cfg)) {
$cfg[] = PHP_EOL;
diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po
index 8c4d5f97..8ce1cf38 100644
--- a/locale/en_US/LC_MESSAGES/messages.po
+++ b/locale/en_US/LC_MESSAGES/messages.po
@@ -362,6 +362,9 @@ msgstr "Log DHCP requests"
msgid "Log DNS queries"
msgstr "Log DNS queries"
+msgid "This toggles the gateway
/nogateway
option for this interface in the DHCPCD configuration."
+msgstr "This toggles the gateway
/nogateway
option for this interface in the DHCPCD configuration."
+
#: includes/hostapd.php
msgid "Basic"
msgstr "Basic"
diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php
index 49758696..83bc3504 100644
--- a/templates/dhcp/general.php
+++ b/templates/dhcp/general.php
@@ -55,6 +55,18 @@
+
+ gateway/nogateway
option for this interface in the DHCPCD configuration.") ?>
+