summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-10-21 21:15:11 +0200
committerDaniil Baturin <daniil@baturin.org>2018-10-21 21:15:11 +0200
commitc912b1a542304dd2adec87bf225bf241ef9cdf7a (patch)
tree3d31a394c708d3b3aff16eee75c7d21cda2459c2 /scripts
parent38174337fbf99ce5159d659a7be943d091e1e631 (diff)
downloadvyatta-cfg-quagga-c912b1a542304dd2adec87bf225bf241ef9cdf7a.tar.gz
vyatta-cfg-quagga-c912b1a542304dd2adec87bf225bf241ef9cdf7a.zip
T799: workaround for FRR being unable to delete entire community lists.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/policy/vyatta-policy.pl24
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/policy/vyatta-policy.pl b/scripts/policy/vyatta-policy.pl
index 4acd1881..9ca97036 100755
--- a/scripts/policy/vyatta-policy.pl
+++ b/scripts/policy/vyatta-policy.pl
@@ -82,11 +82,16 @@ sub update_ext_community_list {
"set policy route extcommunity-list [ standard | expanded ] list-name rule rule-num action { deny | permit }
^^^^^^^^^^^^^^^^^^^^^^^\n";
};
- my $cmdline="$VTYSH -c \"configure terminal\" ";
+
# remove the old rule
- if ( is_extcommunity_list($name) ) {
- $cmdline.= " -c \"no ip extcommunity-list $name\" ";
- };
+ if ( is_extcommunity_list($num) ) {
+ my $clist = `$VTYSH -c \"show ip extcommunity-list $num\" | grep -v \"access list $num\"`;
+ my @oldrules = split(/\n/, $clist);
+ foreach my $oldrule (@oldrules) {
+ print "$oldrule\n";
+ system("$VTYSH -c \"conf t\" -c \"no ip extcommunity-list $num $oldrule\"");
+ }
+ }
$config->setLevel("policy route extcommunity-list $variant $name ");
@rules = $config->listNodes();
@@ -130,10 +135,13 @@ sub update_community_list {
# remove the old rule
if ( is_community_list($num) ) {
- system(
- "$VTYSH -c \"configure terminal\" -c \"no ip community-list $num\" "
- );
- }
+ my $clist = `$VTYSH -c \"show ip community-list $num\" | grep -v \"access list $num\"`;
+ my @oldrules = split(/\n/, $clist);
+ foreach my $oldrule (@oldrules) {
+ print "$oldrule\n";
+ system("$VTYSH -c \"conf t\" -c \"no ip community-list $num $oldrule\"");
+ }
+ }
$config->setLevel("policy community-list $num rule");
@rules = $config->listNodes();