Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RaspAP/raspap-webgui
Browse files Browse the repository at this point in the history
  • Loading branch information
billz committed Jan 4, 2022
2 parents b44bc01 + 793bbfa commit d10e963
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions includes/hostapd.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
// Set dhcp values from system config, fallback to default if undefined
$jsonData = json_decode(getNetConfig($ap_iface), true);
$ip_address = ($jsonData['StaticIP'] == '') ? getDefaultNetValue('dhcp',$ap_iface,'static ip_address') : $jsonData['StaticIP'];
$domain_name_server = ($jsonData['StaticDNS'] =='') ? getDefaultNetValue('dhcp',$ap_iface,'static domain_name_server') : $jsonData['StaticDNS'];
$domain_name_server = ($jsonData['StaticDNS'] =='') ? getDefaultNetValue('dhcp','wlan0','static domain_name_server') : $jsonData['StaticDNS'];
$routers = ($jsonData['StaticRouters'] == '') ? getDefaultNetValue('dhcp',$ap_iface,'static routers') : $jsonData['StaticRouters'];
$netmask = ($jsonData['SubnetMask'] == '' || $jsonData['SubnetMask'] == '0.0.0.0') ? getDefaultNetValue('dhcp',$ap_iface,'subnetmask') : $jsonData['SubnetMask'];
$ip_address.= (!preg_match('/.*\/\d+/', $ip_address)) ? '/'.mask2cidr($netmask) : null;
Expand All @@ -339,10 +339,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config[] = 'nohook wpa_supplicant';
$config[] = PHP_EOL;
} else {
// Default wlan0 config
$def_ip = array();
$config = [ '# RaspAP wlan0 configuration' ];
$config[] = 'interface wlan0';
$config = [ '# RaspAP '.$ap_iface.' configuration' ];
$config[] = 'interface '.$ap_iface;
$config[] = 'static ip_address='.$ip_address;
$config[] = 'static routers='.$routers;
$config[] = 'static domain_name_server='.$domain_name_server;
Expand Down

0 comments on commit d10e963

Please sign in to comment.