[pve-devel] [PATCH 4/6] network: add tap_create

Alexandre Derumier aderumier at odiso.com
Tue Mar 5 10:23:45 CET 2013


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

diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm
index 4cc5fb8..aca6b29 100644
--- a/data/PVE/Network.pm
+++ b/data/PVE/Network.pm
@@ -52,6 +52,18 @@ sub tap_rate_limit {
     setup_tc_rate_limit($iface, $rate, $burst, $debug);
 }
 
+sub tap_create {
+    my ($iface, $bridge) = @_;
+
+    die "unable to get bridge setting\n" if !$bridge;
+
+    my $bridgemtu = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/mtu");
+	die "bridge '$bridge' does not exist\n" if !$bridgemtu;
+
+    eval{ PVE::Tools::run_command("/sbin/ifconfig $iface 0.0.0.0 promisc up mtu $bridgemtu");};
+	die "interface activation failed\n" if $@;
+}
+
 sub copy_bridge_config {
     my ($br0, $br1) = @_;
 
-- 
1.7.10.4




More information about the pve-devel mailing list