summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-01-02 18:06:54 -0800
committerStig Thormodsrud <stig@vyatta.com>2008-01-02 18:06:54 -0800
commitd5b3e4d3c413cbf1a5295e51750258d014478857 (patch)
tree4eeec43e653205846171afc15a1ac69e2877c4fc
parent60fddb5cba5a7d2eb33ba5f77901b71c58ad462a (diff)
downloadvyatta-cfg-d5b3e4d3c413cbf1a5295e51750258d014478857.tar.gz
vyatta-cfg-d5b3e4d3c413cbf1a5295e51750258d014478857.zip
- Allow vpn to be configured on a tunnel interface.
-rwxr-xr-xscripts/VyattaMisc.pm28
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);