diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2015-02-15 13:24:22 +0000 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-02-15 13:24:22 +0000 |
commit | 7ab81d50641b8bbe3dfb6c58b3dcd832215a81d2 (patch) | |
tree | 0580719d5ea1f178e7a97d86d1c20ffb4f8fd5d1 /lib | |
parent | 4258a200d20f4ddf6bac6fea02c311611a124f62 (diff) | |
download | vyatta-cfg-7ab81d50641b8bbe3dfb6c58b3dcd832215a81d2.tar.gz vyatta-cfg-7ab81d50641b8bbe3dfb6c58b3dcd832215a81d2.zip |
vyatta-cfg: update is_primary_address for vtun and wan interfaces
Expand the matching done in is_primary_address to account for the fact
that the output from "ip address show" is different for vtun and wan
interfaces; add a separate check for these interfaces.
Bug #488 http://bugzilla.vyos.net/show_bug.cgi?id=488
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Vyatta/Misc.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index 1f5a915..ac1e90b 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -109,8 +109,15 @@ sub is_primary_address { my $line = `ip address show $hash{$ip_address} | grep 'inet' | head -n 1`; chomp($line); my $primary_address = undef; - if ($line =~ /inet\s+([0-9.]+)\/.*\s([\w.]+)$/) { - $primary_address = $1; + + if ($line =~ /vtun|wan/) { + if ($line =~ /inet\s+([0-9.]+).*\s([\w.]+)$/) { + $primary_address = $1; + } + } else { + if ($line =~ /inet\s+([0-9.]+)\/.*\s([\w.]+)$/) { + $primary_address = $1; + } } return 1 if ($ip_address eq $primary_address); |