mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
add WPAD to dhcp server (#2088)
This commit is contained in:
parent
d092781c0c
commit
8257d1abfa
@ -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";
|
||||
|
||||
@ -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");
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("WPAD");?> </td>
|
||||
<td>
|
||||
<input name="wpad" id="wpad" type="checkbox" value="yes" <?=!empty($pconfig['wpad']) ? "checked=\"checked\"" : ""; ?> />
|
||||
<strong><?= gettext("Enable Web Proxy Auto Discovery") ?></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if (!isset($pool) && !($act == "newpool")): ?>
|
||||
<tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user