[pve-devel] [PATCH] openvz : add tag and firewall options to veth v2

Alexandre Derumier aderumier at odiso.com
Tue May 6 15:40:45 CEST 2014


allow to defined vlan tag and to disable firewall for a specific veth interface

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/OpenVZ.pm |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/OpenVZ.pm b/PVE/OpenVZ.pm
index aa6f502..e1e13f7 100644
--- a/PVE/OpenVZ.pm
+++ b/PVE/OpenVZ.pm
@@ -514,13 +514,16 @@ sub parse_netif {
 
     foreach my $iface (split (/;/, $data)) {
 	my $d = {};
+	$d->{firewall} = 1;
 	foreach my $pv (split (/,/, $iface)) {
-	    if ($pv =~ m/^(ifname|mac|bridge|host_ifname|host_mac|mac_filter)=(.+)$/) {
+	    if ($pv =~ m/^(ifname|mac|bridge|host_ifname|host_mac|mac_filter|tag|firewall)=(.+)$/) {
 		if ($1 eq 'host_ifname') {
 		    $d->{$1} = $2;
 		    $host_ifnames->{$2} = $1;
 		} elsif ($1 eq 'mac_filter') {
 		    $d->{$1} = parse_boolean('mac_filter', $2);
+		} elsif ($1 eq 'firewall') {
+		    $d->{firewall} = undef if $2 == 0;
 		} else {
 		    $d->{$1} = $2;
 		}		
@@ -554,6 +557,8 @@ sub print_netif {
     $res .= ",host_ifname=$net->{host_ifname}" if $net->{host_ifname};
     $res .= ",host_mac=$net->{host_mac}" if $net->{host_mac};
     $res .= ",bridge=$net->{bridge}" if $net->{bridge};
+    $res .= ",tag=$net->{tag}" if $net->{tag};
+    $res .= ",bridge=$net->{firewall}" if $net->{firewall};
 
     if (defined($net->{mac_filter}) && !$net->{mac_filter}) {
 	$res .= ",mac_filter=off"; # 'on' is the default
-- 
1.7.10.4




More information about the pve-devel mailing list