diff --git a/ajax/networking/get_netcfg.php b/ajax/networking/get_netcfg.php index 10d86ad7..cd36a8a3 100644 --- a/ajax/networking/get_netcfg.php +++ b/ajax/networking/get_netcfg.php @@ -46,7 +46,8 @@ if (isset($interface)) { preg_match('/static\sdomain_name_servers=(.*)/', $matched[0], $static_dns); preg_match('/fallback\sstatic_'.$interface.'/', $matched[0], $fallback); $dhcpdata['Metric'] = $metric[1]; - $dhcpdata['StaticIP'] = $static_ip[1]; + $dhcpdata['StaticIP'] = substr($static_ip[1], 0, strpos($static_ip[1],'/')); + $dhcpdata['SubnetMask'] = cidr2mask($static_ip[1]); $dhcpdata['StaticRouters'] = $static_routers[1]; $dhcpdata['StaticDNS'] = $static_dns[1]; $dhcpdata['FallbackEnabled'] = empty($fallback) ? false: true; diff --git a/app/js/custom.js b/app/js/custom.js index 25f121e5..a7eaa3cc 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -246,6 +246,7 @@ function loadInterfaceDHCPSelect() { jsonData = JSON.parse(data); $('#dhcp-iface')[0].checked = jsonData.DHCPEnabled; $('#txtipaddress').val(jsonData.StaticIP); + $('#txtsubnetmask').val(jsonData.SubnetMask); $('#txtgateway').val(jsonData.StaticRouters); $('#chkfallback')[0].checked = jsonData.FallbackEnabled; $('#txtrangestart').val(jsonData.RangeStart); @@ -257,7 +258,7 @@ function loadInterfaceDHCPSelect() { $('#no-resolv')[0].checked = jsonData.upstreamServersEnabled; $('#cbxdhcpupstreamserver').val(jsonData.upstreamServers[0]); $('#txtmetric').val(jsonData.Metric); - if (jsonData.StaticIP !== null && jsonData.StaticIP !== '') { + if (jsonData.StaticIP !== null && jsonData.StaticIP !== '' && !jsonData.FallbackEnabled) { $('#chkstatic').closest('.btn').button('toggle'); $('#chkstatic').closest('.btn').button('toggle').blur(); $('#chkstatic').blur(); @@ -268,6 +269,9 @@ function loadInterfaceDHCPSelect() { $('#chkdhcp').blur(); $('#chkfallback').prop('disabled', false); } + if (jsonData.FallbackEnabled) { + $('#dhcp-iface').prop('disabled', true); + } }); } diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php index 484c2690..49758696 100644 --- a/templates/dhcp/general.php +++ b/templates/dhcp/general.php @@ -41,6 +41,13 @@ +
+
+ + +
+
+