diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index a72f89d17..392212812 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -448,6 +448,7 @@ function services_dhcpdv4_configure($verbose = false) option domain-name "{$config['system']['domain']}"; option ldap-server code 95 = text; option arch code 93 = unsigned integer 16; # RFC4578 +option pac-webui code 252 = text; {$custoptions} default-lease-time 7200; max-lease-time 86400; @@ -804,6 +805,20 @@ EOD; $dhcpdconf .= " option tftp-server-name \"{$dhcpifconf['tftp']}\";\n"; } + + + // add pac url if it applies + if (isset($dhcpifconf['wpad']) && !empty($config['system']['hostname']) && !empty($config['system']['domain'])) { + $protocol = !empty($config['system']['webgui']['protocol']) ? $config['system']['webgui']['protocol'] : 'https'; + // take hostname from system settings - it can be used to be resolved to anything based on client IP + $host = implode('.', array('wpad', $config['system']['domain'])); + $default_port = (isset($config['system']['webgui']['protocol']) && $config['system']['webgui']['protocol'] == 'https') ? 443 : 80; + $port = !empty($config['system']['webgui']['port']) ? $config['system']['webgui']['port'] : $default_port; + $webui_url = "$protocol://$host:$port/wpad.dat"; + + $dhcpdconf .= " option pac-webui \"$webui_url\";\n"; + } + // Handle option, number rowhelper values if (isset($dhcpifconf['numberoptions']['item'])) { $dhcpdconf .= "\n"; diff --git a/src/www/services_dhcp.php b/src/www/services_dhcp.php index c6efb9b8e..782a3fcb2 100644 --- a/src/www/services_dhcp.php +++ b/src/www/services_dhcp.php @@ -98,7 +98,7 @@ $config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'dhcp 'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain', 'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsupdate', 'mac_allow', 'mac_deny', 'tftp', 'ldap', 'netboot', 'nextserver', 'filename', 'filename32', 'filename64', 'rootpath', 'netmask', 'numberoptions', - 'interface_mtu'); + 'interface_mtu', 'wpad'); if ($_SERVER['REQUEST_METHOD'] === 'GET') { // handle identifiers and action @@ -140,6 +140,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } // handle booleans $pconfig['enable'] = isset($dhcpdconf['enable']); + $pconfig['wpad'] = isset($dhcpdconf['wpad']); $pconfig['staticarp'] = isset($dhcpdconf['staticarp']); $pconfig['denyunknown'] = isset($dhcpdconf['denyunknown']); $pconfig['ddnsupdate'] = isset($dhcpdconf['ddnsupdate']); @@ -964,6 +965,13 @@ include("head.inc"); + + + + /> + + +