diff options
Diffstat (limited to 'scripts/VyattaMisc.pm')
-rwxr-xr-x | scripts/VyattaMisc.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/VyattaMisc.pm b/scripts/VyattaMisc.pm index abb5fbb..45bd7d4 100755 --- a/scripts/VyattaMisc.pm +++ b/scripts/VyattaMisc.pm @@ -151,6 +151,27 @@ sub get_eth_ip_addrs { return (@addrs, @virt_addrs); } +sub get_tun_ip_addrs { + my ($vc, $tun_path) = @_; + + my @addrs = (); + my @virt_addrs = (); + + $vc->setLevel("interfaces tunnel $tun_path"); + @addrs = $vc->returnValues("address"); + + # + # check for VIPs + # + $vc->setLevel("interfaces tunnel $tun_path vrrp vrrp-group"); + my @vrrp_groups = $vc->listNodes(); + foreach my $group (@vrrp_groups) { + $vc->setLevel("interfaces tunnel $tun_path vrrp vrrp-group $group"); + @virt_addrs = $vc->returnValues("virtual-address"); + } + return (@addrs, @virt_addrs); +} + sub get_serial_ip_addrs { # # Todo when serial is added @@ -181,6 +202,13 @@ sub isIPinInterfaces { return 1; } } + # tunnel + if ($intf =~ m/^tun\d+$/) { + my @addresses = get_tun_ip_addrs($vc, $intf); + if (is_ip_in_list($ip_addr, @addresses)) { + return 1; + } + } # serial if ($intf =~ m/^wan(\d+).(\d+)$/) { my @addresses = get_serial_ip_addrs($vc, $intf); |