From f6c4a56381915ffaac4571173e986594000f84fc Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 20 Jun 2018 10:27:08 +0200 Subject: [PATCH] INotify: write network: don't duplicate bridge-vids Signed-off-by: Wolfgang Bumiller --- src/PVE/INotify.pm | 3 +- .../t.parsed_options.pl | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/etc_network_interfaces/t.parsed_options.pl diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index d745f0b..0b9ea4a 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -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 index 0000000..40b5b11 --- /dev/null +++ b/test/etc_network_interfaces/t.parsed_options.pl @@ -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;