INotify: write network: don't duplicate bridge-vids
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 20 Jun 2018 08:27:08 +0000 (10:27 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 20 Jun 2018 08:27:08 +0000 (10:27 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/INotify.pm
test/etc_network_interfaces/t.parsed_options.pl [new file with mode: 0644]

index d745f0b..0b9ea4a 100644 (file)
@@ -896,7 +896,7 @@ sub __read_etc_network_interfaces {
                        } else {
                            $d->{$id} = 'off';
                        }
-                   } elsif ($id eq 'bridge_fd') {
+                   } elsif ($id eq 'bridge_fd' || $id eq 'bridge_vids') {
                        $d->{$id} = $value;
                    } elsif ($id eq 'bridge_vlan_aware') {
                        $d->{$id} = 1;
@@ -1096,6 +1096,7 @@ sub __interface_to_string {
            $raw .= "\tbridge-vids $v\n";
        }
        $done->{bridge_vlan_aware} = 1;
+       $done->{bridge_vids} = 1;
     
     } elsif ($d->{type} eq 'bond') {
 
diff --git a/test/etc_network_interfaces/t.parsed_options.pl b/test/etc_network_interfaces/t.parsed_options.pl
new file mode 100644 (file)
index 0000000..40b5b11
--- /dev/null
@@ -0,0 +1,35 @@
+save('proc_net_dev', <<'/proc/net/dev');
+eth0:
+eth1:
+/proc/net/dev
+
+# Check for dropped or duplicated options
+
+my $ip = '192.168.0.2';
+my $nm = '255.255.255.0';
+my $gw = '192.168.0.1';
+my $ip6 = 'fc05::2';
+my $nm6 = '112';
+my $gw6 = 'fc05::1';
+
+# Load
+my $cfg = load('base') . <<"CHECK";
+iface eth1 inet manual
+
+auto vmbr0
+iface vmbr0 inet static
+       address  10.0.0.2
+       netmask  255.255.255.0
+       gateway  10.0.0.1
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
+       bridge-vlan-aware yes
+       bridge-vids 2-4094
+
+CHECK
+
+r $cfg;
+expect $cfg;
+
+1;