From 359297fa01837411050b7b3e61c5ffbb4c3d5ced Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 10 Oct 2014 17:29:04 -0700 Subject: [PATCH] Keep route lines when editing an interface http://virtualmin.com/node/34470 --- net/debian-linux-lib.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/debian-linux-lib.pl b/net/debian-linux-lib.pl index 10a4bd0b2..07a8ff499 100755 --- a/net/debian-linux-lib.pl +++ b/net/debian-linux-lib.pl @@ -233,7 +233,9 @@ foreach $iface (@ifaces) { $found = 1; foreach my $o (@{$iface->[3]}) { if ($o->[0] eq 'gateway' || - $o->[0] eq 'pre-up' && $o->[1] =~ /brctl/) { + $o->[0] eq 'pre-up' && $o->[1] =~ /brctl/ || + $o->[0] =~ /^(pre-)?up$/ && + $o->[1] =~ /ip\s+route/) { push(@options, $o); } } @@ -244,6 +246,9 @@ foreach $iface (@ifaces) { } } +# Remove any duplicate options +@options = grep { !$done{$_->[0],$_->[1]}++ } @options; + if (!$found) { # Add a new interface section if ($in{'vlan'} == 1) {