summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tharp <gxti@partiallystapled.com>2012-07-30 17:36:05 -0400
committerMichael Tharp <gxti@partiallystapled.com>2012-07-30 17:45:00 -0400
commit69dd70883ed300cd169efe04a7ef6797b2eeb30b (patch)
tree630f6065861e35b6874462f573335007809ad417
parent780705e9b8058130fa6b9e15dcca46f85df23395 (diff)
downloadpfsense-69dd70883ed300cd169efe04a7ef6797b2eeb30b.zip
pfsense-69dd70883ed300cd169efe04a7ef6797b2eeb30b.tar.gz
Construct the arguments to dhcrelay -6 correctly
Implements ticket #1663
-rw-r--r--etc/inc/services.inc23
1 files changed, 13 insertions, 10 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 78b810e..4843fdd 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1262,12 +1262,14 @@ function services_dhcrelay6_configure() {
if (is_ipaddrv6(get_interface_ipv6($dhcrelayif)))
$dhcrelayifs[] = get_real_interface($dhcrelayif);
}
+ $dhcrelayifs = array_unique($dhcrelayifs);
/*
* In order for the relay to work, it needs to be active
* on the interface in which the destination server sits.
*/
$srvips = explode(",", $dhcrelaycfg['server']);
+ $srvifaces = array();
foreach ($srvips as $srcidx => $srvip) {
unset($destif);
foreach ($iflist as $ifname) {
@@ -1322,23 +1324,24 @@ function services_dhcrelay6_configure() {
$destif = get_real_interface("wan");
}
- if (!empty($destif))
- $dhcrelayifs[] = $destif;
+ if (!empty($destif)) {
+ $srvifaces[] = "{$srvip}%{$destif}";
+ }
}
- $dhcrelayifs = array_unique($dhcrelayifs);
/* fire up dhcrelay */
- if (empty($dhcrelayifs)) {
+ if (empty($dhcrelayifs) || empty($srvifaces) ) {
log_error("No suitable interface found for running dhcrelay -6!");
return; /* XXX */
}
- $cmd = "/usr/local/sbin/dhcrelay -6 -pf \"{$g['varetc_path']}/dhcrelay6.pid\" -i " . implode(" -i ", $dhcrelayifs);
-
- if (isset($dhcrelaycfg['agentoption']))
- $cmd .= " -a -m replace";
-
- $cmd .= " " . implode(" ", $srvips);
+ $cmd = "/usr/local/sbin/dhcrelay -6 -pf \"{$g['varetc_path']}/dhcrelay6.pid\"";
+ foreach ($dhcrelayifs as $dhcrelayif) {
+ $cmd .= " -l {$dhcrelayif}";
+ }
+ foreach ($srvifaces as $srviface) {
+ $cmd .= " -u \"{$srviface}\"";
+ }
mwexec($cmd);
return 0;
OpenPOWER on IntegriCloud