diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-01-22 13:24:41 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-01-22 13:24:41 -0200 |
commit | 908e598539cbc5a98db19ccc702aa7afe46ec803 (patch) | |
tree | d19b3cb54cb795462ea06b90ca7ca5d712052713 /usr/local | |
parent | b554b869791eca84ac7099813c98a8c43d5e5102 (diff) | |
download | pfsense-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-x | usr/local/www/interfaces_qinq_edit.php | 25 |
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 { |