From 5ec8a7e350286d6a818c742e2bea73bfbe0ca149 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Thu, 4 Sep 2014 14:33:41 +0200 Subject: Allow multiple map and dynamic-map in config file --- scripts/vyos-update-nhrp.pl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/vyos-update-nhrp.pl b/scripts/vyos-update-nhrp.pl index e04503e..b2b6a7e 100644 --- a/scripts/vyos-update-nhrp.pl +++ b/scripts/vyos-update-nhrp.pl @@ -191,29 +191,31 @@ sub tunnel_config { if ( $tunnel_Config->exists("$tunnel_ID map")) { $type = "#spoke"; my @maps = $tunnel_Config->listNodes("$tunnel_ID map"); - my $map = $maps[0]; - push(@conf_file, " map", " $map"); - push(@conf_file, " ", $tunnel_Config->returnValue("$tunnel_ID map $map nbma-address")); shift(@conf_file); unshift(@conf_file, "interface $tunnel_ID $type\n"); + foreach my $map (@maps) { + push(@conf_file, " map", " $map"); + push(@conf_file, " ", $tunnel_Config->returnValue("$tunnel_ID map $map nbma-address")); - if ($tunnel_Config->exists("$tunnel_ID map $map register")) { - push(@conf_file, " register"); - } - if ($tunnel_Config->exists("$tunnel_ID map $map cisco")) { - push(@conf_file, " cisco"); + if ($tunnel_Config->exists("$tunnel_ID map $map register")) { + push(@conf_file, " register"); + } + if ($tunnel_Config->exists("$tunnel_ID map $map cisco")) { + push(@conf_file, " cisco"); + } + push(@conf_file, "\n"); } - push(@conf_file, "\n"); } if ( $tunnel_Config->exists("$tunnel_ID dynamic-map")) { $type = "#spoke"; my @dynmaps = $tunnel_Config->listNodes("$tunnel_ID dynamic-map"); - my $dynmap = $dynmaps[0]; - push(@conf_file, " dynamic-map", " $dynmap"); - push(@conf_file, " ", $tunnel_Config->returnValue("$tunnel_ID dynamic-map $dynmap nbma-domain-name")); shift(@conf_file); unshift(@conf_file, "interface $tunnel_ID $type\n"); - push(@conf_file, "\n"); + foreach my $dynmap (@dynmaps) { + push(@conf_file, " dynamic-map", " $dynmap"); + push(@conf_file, " ", $tunnel_Config->returnValue("$tunnel_ID dynamic-map $dynmap nbma-domain-name")); + push(@conf_file, "\n"); + } } if ( $tunnel_Config->exists("$tunnel_ID shortcut-target")) { my @starget = $tunnel_Config->listNodes("$tunnel_ID shortcut-target"); -- cgit v1.2.3