Disable Multicast Snooping

omega

New Member
May 16, 2012
6
0
1
Hi all,
I'm trying to disable multicast snooping on all bridges which i use with my VM's.
After googling i found a way to disable snooping. I added script to /etc/network/if-up.d/
Code:
echo 0 >/sys/devices/virtual/net/vmbrX/bridge/multicast_snooping
it's working, but after i add to my vm Network Device with vmbrX and vlan tag (for example) 325 a new vmbrXv315 bridge appears and mc snooping starts again.
Is it possible to disable multicast_snooping permanently or better way to disable it with a script on all bridges ?
Thanks.
 
Hi, this is strange, because when creating the bridge-vlan, the multicast_snooping value is copied from parent bridge

Code:
/usr/share/perl5/PVE/Network.pm 

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', 'multicast_snooping', 'multicast_querier'];


    foreach my $sysname (@$br_configs) {
        eval {
            my $v0 = PVE::Tools::file_read_firstline("/sys/class/net/$br0/bridge/$sysname");
            my $v1 = PVE::Tools::file_read_firstline("/sys/class/net/$br1/bridge/$sysname");
            if ($v0 ne $v1) {
                system("echo \"$v0\" > /sys/class/net/$br1/bridge/$sysname") == 0 ||
                    warn "unable to set bridge config '$sysname'\n";
            }
        };
        warn $@ if $@;
    }
}
 
Hi, this is strange, because when creating the bridge-vlan, the multicast_snooping value is copied from parent bridge

Code:
/usr/share/perl5/PVE/Network.pm 

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', 'multicast_snooping', 'multicast_querier'];


    foreach my $sysname (@$br_configs) {
        eval {
            my $v0 = PVE::Tools::file_read_firstline("/sys/class/net/$br0/bridge/$sysname");
            my $v1 = PVE::Tools::file_read_firstline("/sys/class/net/$br1/bridge/$sysname");
            if ($v0 ne $v1) {
                system("echo \"$v0\" > /sys/class/net/$br1/bridge/$sysname") == 0 ||
                    warn "unable to set bridge config '$sysname'\n";
            }
        };
        warn $@ if $@;
    }
}
Here is output of ifconfig before creating vlan:
Code:
root@ProxyMoxy:/# ifconfig | grep vmbr
vmbr0     Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bc
vmbr1     Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
vmbr1v1   Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
vmbr1v221 Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
Checking that multicast snooping on parent vlan is disabled:
Code:
root@ProxyMoxy:/# cat /sys/devices/virtual/net/vmbr1/bridge/multicast_snooping
0
Ifconfig output after creating vlan 480:
Code:
root@ProxyMoxy:/# ifconfig | grep vmbr
vmbr0     Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bc
vmbr1     Link encap:Ethernet  HWaddr [COLOR=#3E3E3E]a0:9d:67:24:d3:bf[/COLOR]
vmbr1v1   Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
vmbr1v221 Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
vmbr1v480 Link encap:Ethernet  HWaddr a0:9d:67:24:d3:bf
Checking if multicast snooping is disabled:
Code:
root@ProxyMoxy:/# cat /sys/devices/virtual/net/vmbr1v480/bridge/multicast_snooping
1
So it's enabled again.... :(
pveversion output:
Code:
pve-manager/3.1-24/060bd5a6 (running kernel: 2.6.32-23-pve)
 
Hi,
here a patch to resolve the bug.
Thanks for the report !

Code:
---
 data/PVE/Network.pm |    9 +++++++++
 1 file changed, 9 insertions(+)


diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm
index 98ef18e..99350cb 100644
--- a/data/PVE/Network.pm
+++ b/data/PVE/Network.pm
@@ -168,6 +168,15 @@ sub copy_bridge_config {
        eval {
            my $v0 = PVE::Tools::file_read_firstline("/sys/class/net/$br0/bridge/$sysname");
            my $v1 = PVE::Tools::file_read_firstline("/sys/class/net/$br1/bridge/$sysname");
+
+           if($v0 =~ m/^(\S+)/){
+               $v0 = $1;
+           }
+
+           if($v1 =~ m/^(\S+)/){
+               $v1 = $1;
+           }
+ 
            if ($v0 ne $v1) {
                system("echo \"$v0\" > /sys/class/net/$br1/bridge/$sysname") == 0 ||
                    warn "unable to set bridge config '$sysname'\n";
--
 
Hi,
Thank you for the quick reply !
But patch doesn't work for me. I have same issue after adding these lines in to /usr/share/perl5/PVE/Network.pm

Code:
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', 'multicast_snooping', 'multicast_querier'];


    foreach my $sysname (@$br_configs) {
        eval {
            my $v0 = PVE::Tools::file_read_firstline("/sys/class/net/$br0/bridge/$sysname");
            my $v1 = PVE::Tools::file_read_firstline("/sys/class/net/$br1/bridge/$sysname");


            if($v0 =~ m/^(\S+)/){
                $v0 = $1;
            }


            if($v1 =~ m/^(\S+)/){
                $v1 = $1;
            }
            if ($v0 ne $v1) {
                system("echo \"$v0\" > /sys/class/net/$br1/bridge/$sysname") == 0 ||
                    warn "unable to set bridge config '$sysname'\n";
            }
        };
        warn $@ if $@;
    }
}
Should I restart any services for patch to work?
Thanks.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!