summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-01-22 13:24:41 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-01-22 13:24:41 -0200
commit908e598539cbc5a98db19ccc702aa7afe46ec803 (patch)
treed19b3cb54cb795462ea06b90ca7ca5d712052713 /usr/local
parentb554b869791eca84ac7099813c98a8c43d5e5102 (diff)
downloadpfsense-908e598539cbc5a98db19ccc702aa7afe46ec803.zip
pfsense-908e598539cbc5a98db19ccc702aa7afe46ec803.tar.gz
When QinQ members are changed, make sure interfaces are created/destroyed (attempt 2)
Diffstat (limited to 'usr/local')
-rwxr-xr-xusr/local/www/interfaces_qinq_edit.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/usr/local/www/interfaces_qinq_edit.php b/usr/local/www/interfaces_qinq_edit.php
index 16e629c..a27a5d3 100755
--- a/usr/local/www/interfaces_qinq_edit.php
+++ b/usr/local/www/interfaces_qinq_edit.php
@@ -150,22 +150,25 @@ if ($_POST) {
if (isset($id) && $a_qinqs[$id]) {
$omembers = explode(" ", $a_qinqs[$id]['members']);
$delmembers = array_diff($omembers, $nmembers);
- if (count($delmembers) > 0) {
+ $addmembers = array_diff($nmembers, $omembers);
+
+ if ((count($delmembers) > 0) || (count($addmembers) > 0)) {
+ $fd = fopen("{$g['tmp_path']}/netgraphcmd", "w");
foreach ($delmembers as $tag) {
- mwexec("/usr/sbin/ngctl shutdown {$qinqentry['vlanif']}h{$tag}:");
- mwexec("/usr/sbin/ngctl msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"");
+ fwrite($fd, "shutdown {$qinqentry['vlanif']}h{$tag}:\n");
+ fwrite($fd, "msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"\n");
}
- }
- $addmembers = array_diff($nmembers, $omembers);
- if (count($addmembers) > 0) {
+
foreach ($addmembers as $member) {
+ $qinq = array();
+ $qinq['if'] = $qinqentry['vlanif'];
+ $qinq['tag'] = $member;
$macaddr = get_interface_mac($qinqentry['vlanif']);
- mwexec("/usr/sbin/ngctl mkpeer {$$qinqentry['vlanif']}qinq: eiface {$$qinqentry['vlanif']}{$member} ether");
- mwexec("/usr/sbin/ngctl name {$qinqentry['vlanif']}qinq:{$qinqentry['vlanif']}{$tag} {$qinqentry['vlanif']}h{$member}");
- mwexec("/usr/sbin/ngctl msg {$qinqentry['vlanif']}qinq: addfilter '{ vlan={$member} hook=\\\"{$qinqentry['vlanif']}{$member}\\\" }'");
- mwexec("/usr/sbin/ngctl msg {$qinqentry['vlanif']}h{$tag}: setifname \\\"{$qinqentry['vlanif']}_{$member}\\\"");
- mwexec("/usr/sbin/ngctl msg {$qinqentry['vlanif']}h{$member}: set {$macaddr}");
+ interface_qinq2_configure($qinq, $fd, $macaddr);
}
+
+ fclose($fd);
+ mwexec("/usr/sbin/ngctl -f {$g['tmp_path']}/netgraphcmd");
}
$a_qinqs[$id] = $qinqentry;
} else {
OpenPOWER on IntegriCloud