summaryrefslogtreecommitdiff
path: root/scripts/policy
diff options
context:
space:
mode:
authorRobert Bays <rbays@moresby.vyatta.com>2008-03-11 22:00:52 -0700
committerRobert Bays <rbays@moresby.vyatta.com>2008-03-11 22:00:52 -0700
commit8a3b25bcf8f6e2b866c6f03d5b3af2b50197b2a7 (patch)
tree25c49ea417b23252a9058aaa3757007405bc0deb /scripts/policy
parentf9ea788b5b2ab25171aa19b98327dacbf0348303 (diff)
downloadvyatta-cfg-quagga-8a3b25bcf8f6e2b866c6f03d5b3af2b50197b2a7.tar.gz
vyatta-cfg-quagga-8a3b25bcf8f6e2b866c6f03d5b3af2b50197b2a7.zip
fixes for bugs 2713, 2541, 2888, 2676
Diffstat (limited to 'scripts/policy')
-rwxr-xr-xscripts/policy/vyatta-policy.pl22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/policy/vyatta-policy.pl b/scripts/policy/vyatta-policy.pl
index b47d9c96..e840271e 100755
--- a/scripts/policy/vyatta-policy.pl
+++ b/scripts/policy/vyatta-policy.pl
@@ -10,6 +10,7 @@ GetOptions("update-access-list=s" => \$accesslist,
"update-community-list=s" => \$communitylist,
"check-peer-syntax=s" => \$peer,
"check-routemap-action=s" => \$routemap,
+ "check-delete-routemap-action=s" => \$deleteroutemap,
);
if (defined $accesslist) { update_access_list($accesslist); }
@@ -17,6 +18,7 @@ if (defined $aspathlist) { update_as_path($aspathlist); }
if (defined $communitylist) { update_community_list($communitylist); }
if (defined $peer) { check_peer_syntax($peer); }
if (defined $routemap) { check_routemap_action($routemap); }
+if (defined $deleteroutemap) { check_delete_routemap_action($deleteroutemap); }
exit 0;
@@ -215,7 +217,7 @@ sub update_access_list() {
# check if the action has been changed since the last commit.
# we need to do this because quagga will wipe the entire config if
# the action is changed.
-# $1 = policy route-map <name> rule <num>
+# $1 = policy route-map <name> rule <num> action
sub check_routemap_action() {
my $routemap = shift;
my $config = new VyattaConfig;
@@ -225,11 +227,25 @@ sub check_routemap_action() {
if ($origvalue) {
my $value = $config->returnValue();
if ("$value" ne "$origvalue") {
- print "You can not change the action for $routemap.\n";
- print "To change the action you must first delete the rule and commit it.\n\n";
exit 1;
}
}
exit 0;
}
+
+## check_delete_routemap_action
+# don't allow deleteing the route-map action if other sibling nodes exist.
+# action is required for all other route-map definitions
+# $1 = policy route-map <name> rule <num>
+sub check_delete_routemap_action() {
+ my $routemap = shift;
+ my $config = new VyattaConfig;
+
+ my @nodes = $config->listNodes("$routemap");
+ if (defined @nodes) {
+ exit 1
+ }
+
+ exit 0;
+}