Minor: untabify

This commit is contained in:
billz 2020-05-12 08:10:54 +01:00
parent 15032a3f44
commit dabec46511
1 changed files with 8 additions and 9 deletions

View File

@ -304,7 +304,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$domain_name_server = ($intConfig['domain_name_server'] =='') ? '1.1.1.1 8.8.8.8' : $intConfig['domain_name_server'];
$routers = ($intConfig['routers'] == '') ? '10.3.141.1' : $intConfig['routers'];
// load the defaults for dhcpcd.conf
// load the defaults for dhcpcd.conf
$config = file_get_contents(RASPI_CONFIG_NETWORKING.'/defaults')."\n\n";
$config = explode('\n', $config);
@ -320,14 +320,14 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config[] = 'nohook wpa_supplicant';
} else {
// Default config
$ip_address = "10.3.141.1/24"; // fallback IP
// default IP of the AP xxx.xxx.xxx.1/24 of the selected dhcp range
$def_ip = array();
$ip_address = "10.3.141.1/24"; // fallback IP
// default IP of the AP xxx.xxx.xxx.1/24 of the selected dhcp range
$def_ip = array();
if (preg_match("/^([0-9]{1,3}\.){3}/",$dhcp_range,$def_ip) ) $ip_address = $def_ip[0]."1/24";
// use static IP assigned to interface only, if consistent with the selected dhcp range
// use static IP assigned to interface only, if consistent with the selected dhcp range
if (preg_match("/^([0-9]{1,3}\.){3}/",$intConfig['ip_address'],$int_ip) && $def_ip[0] === $int_ip[0]) $ip_address = $intConfig['ip_address'];
$routers = ""; // NO default route to be set for the hotspot. This screws up the routing!
$routers = ""; // NO default route to be set for the hotspot. This screws up the routing!
$config[] = 'interface '.$_POST['interface'];
$config[] = 'static ip_address='.$ip_address;
$config[] = 'static routers='.$routers;
@ -346,10 +346,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config[] = 'static ip_address='.$ip_address;
$config[] = 'static routers='.$routers;
$config[] = 'static domain_name_server='.$domain_name_server;
$config[] = PHP_EOL;
}
$config[] = PHP_EOL;
}
$config = join(PHP_EOL, $config);
file_put_contents("/tmp/dhcpddata", $config);
system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return);