[pve-devel] [PATCH] allow random openvz interface name for non firewalled interface

Alexandre Derumier aderumier at odiso.com
Fri May 16 09:43:56 CEST 2014


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 data/PVE/Network.pm |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm
index ff4aa73..b30ec54 100644
--- a/data/PVE/Network.pm
+++ b/data/PVE/Network.pm
@@ -77,7 +77,8 @@ my $parse_tap_devive_name = sub {
 	$vmid = $1;
 	$devid = $2;
     } else {
-	die "wrong interface name $iface";
+	$vmid = undef;
+	$devid = undef;
     }
 
     return ($vmid, $devid);
@@ -87,7 +88,6 @@ my $compute_fwbr_names = sub {
     my ($vmid, $devid) = @_;
 
     my $fwbr = "fwbr${vmid}i${devid}";
-    # Note: the firewall use 'fwln+' to filter traffic to VMs
     my $vethfw = "fwln${vmid}i${devid}";
     my $vethfwpeer = "fwpr${vmid}p${devid}";
     my $ovsintport = "fwln${vmid}o${devid}";
@@ -145,6 +145,7 @@ my $create_firewall_bridge_linux = sub {
     my ($iface, $bridge) = @_;
 
     my ($vmid, $devid) = &$parse_tap_devive_name($iface);
+    die "can't create firewall bridge for random interface name" if !$vmid && !$devid;
     my ($fwbr, $vethfw, $vethfwpeer) = &$compute_fwbr_names($vmid, $devid);
 
     my $bridgemtu = &$read_bridge_mtu($bridge);
@@ -173,6 +174,7 @@ my $create_firewall_bridge_ovs = sub {
     my ($iface, $bridge, $tag) = @_;
 
     my ($vmid, $devid) = &$parse_tap_devive_name($iface);
+    die "can't create firewall bridge for random interface name" if !$vmid && !$devid;
     my ($fwbr, undef, undef, $ovsintport) = &$compute_fwbr_names($vmid, $devid);
 
     my $bridgemtu = &$read_bridge_mtu($bridge);
@@ -194,6 +196,7 @@ my $cleanup_firewall_bridge = sub {
     my ($iface) = @_;
 
     my ($vmid, $devid) = &$parse_tap_devive_name($iface);
+    return if !$vmid && !$devid;
     my ($fwbr, $vethfw, $vethfwpeer, $ovsintport) = &$compute_fwbr_names($vmid, $devid);
 
     # cleanup old port config from any openvswitch bridge
-- 
1.7.10.4




More information about the pve-devel mailing list