summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@netgate.com>2019-06-03 12:47:51 -0400
committerjim-p <jimp@netgate.com>2019-06-03 12:48:37 -0400
commitef0045d8127566c57be4d4f3a3986cdcbe9cd095 (patch)
treec5b787a9c11fcd336e249b6449a9e5c22b45c971
parent113173b9823aa2712c643c919f70e9d6a34df69d (diff)
downloadpfsense-ef0045d8127566c57be4d4f3a3986cdcbe9cd095.zip
pfsense-ef0045d8127566c57be4d4f3a3986cdcbe9cd095.tar.gz
Teach dhcrelay about upstream and downstream interfaces. Fixes #9466
No config changes or UI changes, it is handled automatically. (cherry picked from commit f427d68dbca5ed9941b3bc01be1c4d81417c134f)
-rw-r--r--src/etc/inc/services.inc21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index 8fc5309..894a19e 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -1742,6 +1742,7 @@ function services_dhcrelay_configure() {
$iflist = get_configured_interface_list();
+ $dhcrelayifs = array();
$dhcifaces = explode(",", $dhcrelaycfg['interface']);
foreach ($dhcifaces as $dhcrelayif) {
if (!isset($iflist[$dhcrelayif]) ||
@@ -1753,6 +1754,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
@@ -1763,22 +1765,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";
OpenPOWER on IntegriCloud