X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=data%2FPVE%2FNetwork.pm;h=e7521f7531c0b8edc65d39b7ef39bda703229653;hp=aca6b29d1105bfd93ceb770f07295bddae7dc2e6;hb=ba4af65b3550c91782e2c1471f345d578aa4366b;hpb=3aa99c70062f122dfe8bcb9a97789d6d97686fd4 diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm index aca6b29..e7521f7 100644 --- a/data/PVE/Network.pm +++ b/data/PVE/Network.pm @@ -16,7 +16,7 @@ sub setup_tc_rate_limit { system("/sbin/tc qdisc del dev $iface ingress >/dev/null 2>&1"); system("/sbin/tc qdisc del dev $iface root >/dev/null 2>&1"); - return if (!$rate || ($rate && $rate == 0)); + return if !$rate; run_command("/sbin/tc qdisc add dev $iface handle ffff: ingress"); @@ -64,13 +64,32 @@ sub tap_create { die "interface activation failed\n" if $@; } +sub tap_plug { + my ($iface, $bridge, $tag) = @_; + + my $newbridge = activate_bridge_vlan($bridge, $tag); + copy_bridge_config($bridge, $newbridge) if $bridge ne $newbridge; + + system ("/usr/sbin/brctl addif $newbridge $iface") == 0 || + die "can't add interface to bridge\n"; +} + +sub tap_unplug { + my ($iface, $bridge, $tag) = @_; + + $bridge .= "v$tag" if $tag; + + system ("/usr/sbin/brctl delif $bridge $iface") == 0 || + die "can't del interface from bridge\n"; +} + sub copy_bridge_config { my ($br0, $br1) = @_; return if $br0 eq $br1; my $br_configs = [ 'ageing_time', 'stp_state', 'priority', 'forward_delay', - 'hello_time', 'max_age']; + 'hello_time', 'max_age', 'multicast_snooping', 'multicast_querier']; foreach my $sysname (@$br_configs) { eval {