[pve-devel] [PATCH pve-common V2 4/4] INotify: check duplicate interface name by family

Alexandre Derumier aderumier at odiso.com
Fri Mar 29 00:23:40 CET 2019


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

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 0dae177..70c34b1 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -914,6 +914,10 @@ sub __read_etc_network_interfaces {
 	    my $f = { method => $3 }; # by family, merged to $d with a $suffix
 	    (my $suffix = $family) =~ s/^inet//;
 
+	    foreach my $existing_family (@{$ifaces->{$i}->{'families'}}) {
+		die "interface $i with family $family already exist" if $family eq $existing_family;
+	    }
+
 	    my $d = $ifaces->{$i} ||= {};
 	    $d->{priority} = $priority++ if !$d->{priority};
 	    push @{$d->{families}}, $family;
-- 
2.11.0




More information about the pve-devel mailing list