mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Teach dhcrelay about upstream and downstream interfaces. Fixes #9466
No config changes or UI changes, it is handled automatically.
This commit is contained in:
parent
086cc72c26
commit
f427d68dbc
@ -1747,6 +1747,7 @@ function services_dhcrelay_configure() {
|
||||
|
||||
$iflist = get_configured_interface_list();
|
||||
|
||||
$dhcrelayifs = array();
|
||||
$dhcifaces = explode(",", $dhcrelaycfg['interface']);
|
||||
foreach ($dhcifaces as $dhcrelayif) {
|
||||
if (!isset($iflist[$dhcrelayif]) ||
|
||||
@ -1758,6 +1759,7 @@ function services_dhcrelay_configure() {
|
||||
$dhcrelayifs[] = get_real_interface($dhcrelayif);
|
||||
}
|
||||
}
|
||||
$dhcrelayifs = array_unique($dhcrelayifs);
|
||||
|
||||
/*
|
||||
* In order for the relay to work, it needs to be active
|
||||
@ -1768,22 +1770,31 @@ function services_dhcrelay_configure() {
|
||||
log_error(gettext("No destination IP has been configured!"));
|
||||
return;
|
||||
}
|
||||
|
||||
$srvifaces = array();
|
||||
foreach ($srvips as $srcidx => $srvip) {
|
||||
$destif = guess_interface_from_ip($srvip);
|
||||
if (!empty($destif)) {
|
||||
$dhcrelayifs[] = $destif;
|
||||
$srvifaces[] = $destif;
|
||||
}
|
||||
}
|
||||
$dhcrelayifs = array_unique($dhcrelayifs);
|
||||
$srvifaces = array_unique($srvifaces);
|
||||
|
||||
/* The server interface(s) should not be in this list */
|
||||
$dhcrelayifs = array_diff($dhcrelayifs, $srvifaces);
|
||||
|
||||
/* fire up dhcrelay */
|
||||
if (empty($dhcrelayifs)) {
|
||||
log_error(gettext("No suitable interface found for running dhcrelay!"));
|
||||
log_error(gettext("No suitable downstream interfaces found for running dhcrelay!"));
|
||||
return; /* XXX */
|
||||
}
|
||||
if (empty($srvifaces)) {
|
||||
log_error(gettext("No suitable upstream interfaces found for running dhcrelay!"));
|
||||
return; /* XXX */
|
||||
}
|
||||
|
||||
$cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs);
|
||||
$cmd = "/usr/local/sbin/dhcrelay";
|
||||
$cmd .= " -id " . implode(" -id ", $dhcrelayifs);
|
||||
$cmd .= " -iu " . implode(" -iu ", $srvifaces);
|
||||
|
||||
if (isset($dhcrelaycfg['agentoption'])) {
|
||||
$cmd .= " -a -m replace";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user