1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Merge pull request #505 from glaszig/fix/dhcpcd-config

respect common dhcpcd config options in ap mode
This commit is contained in:
Bill Zimmerman 2020-02-29 18:07:11 +01:00 committed by GitHub
commit 8a1f75b256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,33 +276,35 @@ 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']; $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']; $routers = ($intConfig['routers'] == '') ? '10.3.141.1' : $intConfig['routers'];
$config = [ '# RaspAP wlan0 configuration' ];
$config[] = 'hostname';
$config[] = 'clientid';
$config[] = 'persistent';
$config[] = 'option rapid_commit';
$config[] = 'option domain_name_servers, domain_name, domain_search, host_name';
$config[] = 'option classless_static_routes';
$config[] = 'option ntp_servers';
$config[] = 'require dhcp_server_identifier';
$config[] = 'slaac private';
$config[] = 'nohook lookup-hostname';
if ($wifiAPEnable == 1) { if ($wifiAPEnable == 1) {
// Enable uap0 configuration in dhcpcd for Wifi client AP mode // Enable uap0 configuration in dhcpcd for Wifi client AP mode
$intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/uap0.ini', false, INI_SCANNER_RAW); $intConfig = parse_ini_file(RASPI_CONFIG_NETWORKING.'/uap0.ini', false, INI_SCANNER_RAW);
$ip_address = ($intConfig['ip_address'] == '') ? '192.168.50.1/24' : $intConfig['ip_address']; $ip_address = ($intConfig['ip_address'] == '') ? '192.168.50.1/24' : $intConfig['ip_address'];
$config = PHP_EOL.'# RaspAP uap0 configuration'.PHP_EOL; $config[] = 'interface uap0';
$config.= 'interface uap0'.PHP_EOL; $config[] = 'static ip_address='.$ip_address;
$config.= 'static ip_address='.$ip_address.PHP_EOL; $config[] = 'nohook wpa_supplicant';
$config.= 'nohook wpa_supplicant'.PHP_EOL;
} else { } else {
// Default config // Default config
$ip_address = ($intConfig['ip_address'] == '') ? '10.3.141.1/24' : $intConfig['ip_address']; $ip_address = ($intConfig['ip_address'] == '') ? '10.3.141.1/24' : $intConfig['ip_address'];
$config = '# RaspAP wlan0 configuration'.PHP_EOL; $config[] = 'interface '.RASPI_WIFI_CLIENT_INTERFACE;
$config.= 'hostname'.PHP_EOL; $config[] = 'static ip_address='.$ip_address;
$config.= 'clientid'.PHP_EOL; $config[] = 'static routers='.$routers;
$config.= 'persistent'.PHP_EOL; $config[] = 'static domain_name_server='.$domain_name_server;
$config.= 'option rapid_commit'.PHP_EOL;
$config.= 'option domain_name_servers, domain_name, domain_search, host_name'.PHP_EOL;
$config.= 'option classless_static_routes'.PHP_EOL;
$config.= 'option ntp_servers'.PHP_EOL;
$config.= 'require dhcp_server_identifier'.PHP_EOL;
$config.= 'slaac private'.PHP_EOL;
$config.= 'nohook lookup-hostname'.PHP_EOL;
$config.= 'interface '.RASPI_WIFI_CLIENT_INTERFACE.PHP_EOL;
$config.= 'static ip_address='.$ip_address.PHP_EOL;
$config.= 'static routers='.$routers.PHP_EOL;
$config.= 'static domain_name_server='.$domain_name_server.PHP_EOL;
} }
$config = join(PHP_EOL, $config);
file_put_contents("/tmp/dhcpddata", $config); file_put_contents("/tmp/dhcpddata", $config);
system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return); system('sudo cp /tmp/dhcpddata '.RASPI_DHCPCD_CONFIG, $return);