Commit 0ddcf25d authored by Dietmar Maurer's avatar Dietmar Maurer

openvz: partial support for mac_filter

With this patch interfaces with mac_filter option are at least displayed
on the GUI. But it is still not possible to set the option, because
vzctl netif_add does not support the option.
parent 66e237c4
......@@ -500,11 +500,15 @@ sub parse_netif {
foreach my $iface (split (/;/, $data)) {
my $d = {};
foreach my $pv (split (/,/, $iface)) {
if ($pv =~ m/^(ifname|mac|bridge|host_ifname|host_mac)=(.+)$/) {
$d->{$1} = $2;
if ($pv =~ m/^(ifname|mac|bridge|host_ifname|host_mac|mac_filter)=(.+)$/) {
if ($1 eq 'host_ifname') {
$d->{$1} = $2;
$host_ifnames->{$2} = $1;
}
} elsif ($1 eq 'mac_filter') {
$d->{$1} = parse_boolean('mac_filter', $2);
} else {
$d->{$1} = $2;
}
}
}
if ($d->{ifname}) {
......@@ -536,6 +540,10 @@ sub print_netif {
$res .= ",host_mac=$net->{host_mac}" if $net->{host_mac};
$res .= ",bridge=$net->{bridge}" if $net->{bridge};
if (defined($net->{mac_filter}) && !$net->{mac_filter}) {
$res .= ",mac_filter=off"; # 'on' is the default
}
return $res;
}
......@@ -1095,6 +1103,9 @@ sub update_ovz_config {
$ifadd .= $newif->{$ifname}->{host_ifname} ? ",$newif->{$ifname}->{host_ifname}" : ',';
$ifadd .= $newif->{$ifname}->{host_mac} ? ",$newif->{$ifname}->{host_mac}" : ',';
$ifadd .= $newif->{$ifname}->{bridge} ? ",$newif->{$ifname}->{bridge}" : '';
# not possible with current vzctl
#$ifadd .= $newif->{$ifname}->{mac_filter} ? ",$newif->{$ifname}->{mac_filter}" : '';
if (!$ifaces->{$ifname} || ($ifaces->{$ifname}->{raw} ne $newif->{$ifname}->{raw})) {
push @$changes, '--netif_add', $ifadd;
......
......@@ -149,7 +149,7 @@ Ext.define('PVE.Parser', { statics: {
if (!p || p.match(/^\s*$/)) {
return; // continue
}
var match_res = p.match(/^(ifname|mac|bridge|host_ifname|host_mac)=(\S+)$/);
var match_res = p.match(/^(ifname|mac|bridge|host_ifname|host_mac|mac_filter)=(\S+)$/);
if (!match_res) {
errors = true;
return false; // break
......@@ -175,7 +175,7 @@ Ext.define('PVE.Parser', { statics: {
Ext.Object.each(netif, function(iface, data) {
var tmparray = [];
Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac'], function(key) {
Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter'], function(key) {
var value = data[key];
if (value) {
tmparray.push(key + '=' + value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment