diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-03-04 09:34:20 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-03-04 09:34:20 -0800 |
commit | 8daaf563f262f65fd2eca1cd37956e3d75ef0db0 (patch) | |
tree | ed620f0471d9d06aa323d95cba06bb9e1d2d5804 | |
parent | ba252d598619e12b100378d7afd9056014a3607a (diff) | |
download | vyatta-cfg-quagga-8daaf563f262f65fd2eca1cd37956e3d75ef0db0.tar.gz vyatta-cfg-quagga-8daaf563f262f65fd2eca1cd37956e3d75ef0db0.zip |
Allow multiple values in 'set community'
Bug 5400
Allow for setting multiple values in quoted string for set community.
-rwxr-xr-x | scripts/vyatta_quagga_utils.pl | 22 | ||||
-rw-r--r-- | templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def | 7 |
2 files changed, 22 insertions, 7 deletions
diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl index 1d85b431..0b9fb2ae 100755 --- a/scripts/vyatta_quagga_utils.pl +++ b/scripts/vyatta_quagga_utils.pl @@ -6,15 +6,27 @@ use Vyatta::Misc; use NetAddr::IP; use Getopt::Long; -my ( $prefix, $exists, $not_exists, $area ); +my ( $prefix, $exists, $not_exists, $area, $community ); + +# Allowed well-know community values (see set commuinity) +my %communities = ( + 'additive' => 1, + 'internet' => 1, + 'local-AS' => 1, + 'no-advertise' => 1, + 'no-export' => 1, + 'none' => 1, +); GetOptions( "check-prefix-boundry=s" => \$prefix, "not-exists=s" => \$not_exists, "exists=s" => \$exists, "check-ospf-area=s" => \$area, + "check-community" => \$community, ); +check_community(@ARGV) if ($community); check_prefix_boundry($prefix) if ($prefix); check_not_exists($not_exists) if ($not_exists); check_exists($exists) if ($exists); @@ -74,3 +86,11 @@ sub check_ospf_area { die "Invalid OSPF area: $area\n"; } +sub check_community { + foreach my $arg (@_) { + next if ($arg =~ /\d+:\d+/); + next if $communities{$arg}; + + die "$arg unknown community value\n" + } +} diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def index d03bfc81..5d0ef00d 100644 --- a/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def +++ b/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def @@ -9,12 +9,7 @@ comp_help: \1 <AA:NN>\tcommunity in 4 octet AS:value format allowed:echo "none local-AS no-advertise no-export internet" -syntax:expression: pattern $VAR(@) \ - "^(additive )?([0-9]+:[0-9]+|none|local-AS|no-advertise|no-export|internet)$" \ - ; "\"$VAR(@)\" unknown community string or attribute" - -syntax:expression: "$VAR(@)" != "additive none" \ - ; "\"additive none\" is meaningless" +syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-community $VAR(@)" commit:expression: $VAR(../../action/) != "" \ ; "policy route-map $VAR(../../../@) rule $VAR(../../@): You must specify an action" |