mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Implements nohook wpa_supplicant flag
This commit is contained in:
parent
c971c5c9bc
commit
98d392d473
6 changed files with 37 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Binary file not shown.
|
@ -464,6 +464,15 @@ msgstr "This option adds <code>dhcp-host</code> entries to the dnsmasq configura
|
|||
msgid "This toggles the <code>gateway</code>/<code>nogateway</code> option for this interface in the DHCPCD configuration."
|
||||
msgstr "This toggles the <code>gateway</code>/<code>nogateway</code> option for this interface in the DHCPCD configuration."
|
||||
|
||||
msgid "This toggles the <code>nohook wpa_supplicant</code> option for this interface in the DHCPCD configuration."
|
||||
msgstr "This toggles the <code>nohook wpa_supplicant</code> 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"
|
||||
|
|
|
@ -67,6 +67,19 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" id="nohook-wpa-supplicant" type="checkbox" name="NoHookWPASupplicant" value="1" aria-describedby="hook-wpa-supplicant-description">
|
||||
<label class="custom-control-label" for="nohook-wpa-supplicant"><?php echo _("Disable wpa_supplicant dhcp hook for this interface") ?></label>
|
||||
<?php getTooltip('If you manage wireless connections with wpa_supplicant itself, the hook may create unwanted connection events. This option disables the hook.', 'tipnohook'); ?>
|
||||
</div>
|
||||
<p class="mb-0" id="hook-wpa-supplicant-description">
|
||||
<small><?php echo _("This toggles the <code>nohook wpa_supplicant</code> option for this interface in the DHCPCD configuration.") ?></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="mt-1">DHCP options</h5>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
|
|
Loading…
Reference in a new issue