diff --git a/ajax/networking/get_netcfg.php b/ajax/networking/get_netcfg.php index aa207e1e..aee8e702 100644 --- a/ajax/networking/get_netcfg.php +++ b/ajax/networking/get_netcfg.php @@ -46,6 +46,7 @@ if (isset($interface)) { 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); + preg_match('/nohook\swpa_supplicant/', $matched[0], $nohook_wpa_supplicant); $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]); @@ -53,6 +54,7 @@ if (isset($interface)) { $dhcpdata['StaticDNS'] = $static_dns[1]; $dhcpdata['FallbackEnabled'] = empty($fallback) ? false: true; $dhcpdata['DefaultRoute'] = $gateway[0] == "gateway"; + $dhcpdata['NoHookWPASupplicant'] = $nohook_wpa_supplicant[0] == "nohook wpa_supplicant"; echo json_encode($dhcpdata); } diff --git a/app/js/custom.js b/app/js/custom.js index 40e181bc..93e91c2a 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -216,6 +216,12 @@ function loadInterfaceDHCPSelect() { $('#txtgateway').val(jsonData.StaticRouters); $('#chkfallback')[0].checked = jsonData.FallbackEnabled; $('#default-route').prop('checked', jsonData.DefaultRoute); + if (strInterface.startsWith("wl")) { + $('#nohook-wpa-supplicant').parent().parent().parent().show() + $('#nohook-wpa-supplicant').prop('checked', jsonData.NoHookWPASupplicant); + } else { + $('#nohook-wpa-supplicant').parent().parent().parent().hide() + } $('#txtrangestart').val(jsonData.RangeStart); $('#txtrangeend').val(jsonData.RangeEnd); $('#txtrangeleasetime').val(jsonData.leaseTime); diff --git a/includes/dhcp.php b/includes/dhcp.php index 9165e8ae..40570bbb 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -253,24 +253,27 @@ function updateDHCPConfig($iface,$status) { $cfg[] = '# RaspAP '.$iface.' configuration'; $cfg[] = 'interface '.$iface; - if (isset($_POST['StaticIP'])) { + if (isset($_POST['StaticIP']) && $_POST['StaticIP'] !== '') { $mask = ($_POST['SubnetMask'] !== '' && $_POST['SubnetMask'] !== '0.0.0.0') ? '/'.mask2cidr($_POST['SubnetMask']) : null; $cfg[] = 'static ip_address='.$_POST['StaticIP'].$mask; } - if (isset($_POST['DefaultGateway'])) { - $cfg[] = 'static routers='.$_POST['DefaultGateway']; + if (isset($_POST['DefaultGateway']) && $_POST['DefaultGateway'] !== '') { + $cfg[] = 'static routers='.$_POST['DefaultGateway']; } if ($_POST['DNS1'] !== '' || $_POST['DNS2'] !== '') { $cfg[] = 'static domain_name_server='.$_POST['DNS1'].' '.$_POST['DNS2']; } if ($_POST['Metric'] !== '') { - $cfg[] = 'metric '.$_POST['Metric']; + $cfg[] = 'metric '.$_POST['Metric']; } if ($_POST['Fallback'] == 1) { $cfg[] = 'profile static_'.$iface; $cfg[] = 'fallback static_'.$iface; } $cfg[] = $_POST['DefaultRoute'] == '1' ? 'gateway' : 'nogateway'; + if (( substr($iface, 0, 2) === "wl") && $_POST['NoHookWPASupplicant'] == '1') { + $cfg[] = 'nohook wpa_supplicant'; + } $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.mo b/locale/en_US/LC_MESSAGES/messages.mo index a534b424..2e8e16f3 100644 Binary files a/locale/en_US/LC_MESSAGES/messages.mo and b/locale/en_US/LC_MESSAGES/messages.mo differ diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po index 2a4672c8..89eb0f97 100644 --- a/locale/en_US/LC_MESSAGES/messages.po +++ b/locale/en_US/LC_MESSAGES/messages.po @@ -464,6 +464,15 @@ msgstr "This option adds dhcp-host entries to the dnsmasq configura 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." +msgid "This toggles the nohook wpa_supplicant option for this interface in the DHCPCD configuration." +msgstr "This toggles the nohook wpa_supplicant option for this interface in the DHCPCD configuration." + +msgid "Disable wpa_supplicant dhcp hook for this interface" +msgstr "Disable wpa_supplicant dhcp hook for this interface" + +msgid "If you manage wireless connections with wpa_supplicant itself, the hook may create unwanted connection events. This option disables the hook." +msgstr "If you manage wireless connections with wpa_supplicant itself, the hook may create unwanted connection events. This option disables the hook." + #: includes/hostapd.php msgid "Basic" msgstr "Basic" diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php index 47c802f5..5f257c02 100644 --- a/templates/dhcp/general.php +++ b/templates/dhcp/general.php @@ -67,6 +67,19 @@ +
+
+
+ + + +
+

+ nohook wpa_supplicant option for this interface in the DHCPCD configuration.") ?> +

+
+
+
DHCP options