Bugfix: handle subnetmask null value

This commit is contained in:
billz
2020-12-03 10:29:11 +00:00
parent 8420bbb0da
commit 1c6d837a80
2 changed files with 3 additions and 2 deletions

View File

@@ -187,7 +187,8 @@ function UpdateDHCPConfig($iface,$status)
$cfg[] = '# RaspAP '.$iface.' configuration';
$cfg[] = 'interface '.$iface;
if (isset($_POST['StaticIP'])) {
$cfg[] = 'static ip_address='.$_POST['StaticIP'].'/'.mask2cidr($_POST['SubnetMask']);
$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'];