Merge pull request #1515 from RaspAP/fix/parse-dhcp

Update parsing of dhcp-range
This commit is contained in:
Bill Zimmerman 2024-02-08 08:46:11 +01:00 committed by GitHub
commit 804034a871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,11 @@ if (isset($interface)) {
$conf = ParseConfig($return);
$dhcpdata['DHCPEnabled'] = empty($conf) ? false : true;
$arrRange = explode(",", $conf['dhcp-range'][0]);
if (is_string($conf['dhcp-range'])) {
$arrRange = explode(",", $conf['dhcp-range']);
} else {
$arrRange = explode(",", $conf['dhcp-range'][0]);
}
$dhcpdata['RangeStart'] = $arrRange[0];
$dhcpdata['RangeEnd'] = $arrRange[1];
$dhcpdata['RangeMask'] = $arrRange[2];
@ -55,6 +59,5 @@ if (isset($interface)) {
$dhcpdata['FallbackEnabled'] = empty($fallback) ? false: true;
$dhcpdata['DefaultRoute'] = $gateway[0] == "gateway";
$dhcpdata['NoHookWPASupplicant'] = $nohook_wpa_supplicant[0] == "nohook wpa_supplicant";
echo json_encode($dhcpdata);
}