diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2011-01-01 16:14:48 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2011-01-01 16:14:48 -0800 |
commit | 47914551530e3ef2232ce18959d08a6018f9a580 (patch) | |
tree | e0e8d6f9fbbc32bd68694510f5b381dfea8c9814 | |
parent | fa8b079a5e0b370bee12ba9bde63eef925ef4043 (diff) | |
parent | e09955a8cfc8a2d8f10f0aa3c4f1bdf8e33bdb16 (diff) | |
download | vyatta-cfg-quagga-47914551530e3ef2232ce18959d08a6018f9a580.tar.gz vyatta-cfg-quagga-47914551530e3ef2232ce18959d08a6018f9a580.zip |
Merge branch 'mendocino' of http://git.vyatta.com/vyatta-cfg-quagga into mendocino
-rw-r--r-- | .frlog | 1 | ||||
-rw-r--r-- | debian/changelog | 69 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/linda | 1 | ||||
-rw-r--r-- | lib/Vyatta/Quagga/Config.pm | 126 | ||||
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 53 | ||||
-rw-r--r-- | templates/protocols/bgp/node.def | 6 | ||||
-rw-r--r-- | templates/protocols/bgp/node.tag/neighbor/node.def | 2 | ||||
-rw-r--r-- | templates/protocols/ospfv3/area/node.tag/.filter-list/node.def | 2 | ||||
-rw-r--r-- | templates/protocols/ospfv3/area/node.tag/.filter-list/node.tag/node.def | 2 | ||||
-rw-r--r-- | templates/protocols/rip/network-distance/node.tag/access-list/node.def | 2 | ||||
-rw-r--r-- | templates/protocols/rip/timers/garbage-collection/node.def | 2 |
12 files changed, 172 insertions, 96 deletions
@@ -0,0 +1 @@ +Tue Dec 28 20:35:30 UTC 2010: [new branch] at [debian/0.18.123] diff --git a/debian/changelog b/debian/changelog index 30d6a6ed..217b6368 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,72 @@ +vyatta-cfg-quagga (0.18.123+mendocino1) unstable; urgency=low + + * new branch + + -- An-Cheng Huang <ancheng@vyatta.com> Tue, 28 Dec 2010 20:35:32 +0000 + +vyatta-cfg-quagga (0.18.123) unstable; urgency=low + + * Fix help text + + -- Stephen Hemminger <stephen.hemminger@vyatta.com> Tue, 21 Dec 2010 13:42:33 -0800 + +vyatta-cfg-quagga (0.18.122) unstable; urgency=low + + * Fix check for local IP address + + -- Stephen Hemminger <stephen.hemminger@vyatta.com> Mon, 06 Dec 2010 16:46:58 -0800 + +vyatta-cfg-quagga (0.18.121) unstable; urgency=low + + * clean up code + + -- Robert Bays <robert@vyatta.com> Sat, 04 Dec 2010 17:43:41 -0800 + +vyatta-cfg-quagga (0.18.120) unstable; urgency=low + + * fix ordering for non-consistent commands + * add debug function to clean up code + + -- Robert Bays <robert@vyatta.com> Fri, 03 Dec 2010 17:57:58 -0800 + +vyatta-cfg-quagga (0.18.119) unstable; urgency=low + + * fix for bug 6481. change the tree walk order. add support for + predefined order walks. + + -- Robert Bays <robert@vyatta.com> Thu, 02 Dec 2010 17:28:46 -0800 + +vyatta-cfg-quagga (0.18.118) unstable; urgency=low + + * remove deprecated linda override + + -- Stephen Hemminger <stephen.hemminger@vyatta.com> Fri, 26 Nov 2010 11:09:20 -0800 + +vyatta-cfg-quagga (0.18.117) unstable; urgency=low + + * Need to skip LAST node tag when configuring bgp node, but let all + others through. + + -- Michael <mike@vyatta.com> Fri, 19 Nov 2010 09:24:56 -0800 + +vyatta-cfg-quagga (0.18.116) unstable; urgency=low + + * update to use getIP + + -- Robert Bays <robert@vyatta.com> Fri, 19 Nov 2010 11:33:57 -0800 + +vyatta-cfg-quagga (0.18.115) unstable; urgency=low + + * fix bug 6430 + + -- Robert Bays <robert@vyatta.com> Thu, 18 Nov 2010 17:51:29 -0800 + +vyatta-cfg-quagga (0.18.114) unstable; urgency=low + + * fix for 6069 + + -- Michael Larson <mike@vyatta.com> Thu, 18 Nov 2010 16:48:11 -0800 + vyatta-cfg-quagga (0.18.113) unstable; urgency=low * Revert "Looks like merge with larkspur missed this..." diff --git a/debian/control b/debian/control index 6f7caa3b..35bdf71d 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Depends: sed (>= 4.1.5), perl (>= 5.8.8), procps (>= 1:3.2.7-3), coreutils (>= 5.97-5.3), - vyatta-cfg (>= 0.15.33), + vyatta-cfg (>= 0.18.56), libc6 (>= 2.7-6), vyatta-bash | bash (>= 3.1), vyatta-quagga (>= 0.99.15-26) diff --git a/debian/linda b/debian/linda deleted file mode 100644 index 0381d9d0..00000000 --- a/debian/linda +++ /dev/null @@ -1 +0,0 @@ -Tag: file-in-opt diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm index 8afc1bed..1177f97d 100644 --- a/lib/Vyatta/Quagga/Config.pm +++ b/lib/Vyatta/Quagga/Config.pm @@ -63,6 +63,10 @@ sub setDebugLevel { return 0; } +sub returnDebugLevel { + return $_DEBUG; +} + # reinitialize the vtysh hashes for troublshooting tree # walk post object creation sub _reInitialize { @@ -78,7 +82,7 @@ sub _reInitialize { sub returnQuaggaCommands { my ($self, $arrayref) = @_; - foreach my $key (sort { $b cmp $a } keys %_vtyshdel) { + foreach my $key (reverse sort keys %_vtyshdel) { foreach my $string (@{$_vtyshdel{$key}}) { push @{$arrayref}, "$string"; } @@ -95,31 +99,39 @@ sub returnQuaggaCommands { # methods to send the commands to Quagga sub setConfigTree { - my ($self, $level, @skip_list) = @_; - if (_setConfigTree($level, 0, 0, @skip_list)) { return 1; } + my ($self, $level, $skip_list, $ordered_list) = @_; + if (_setConfigTree($level, 0, 0, $skip_list, $ordered_list)) { return 1; } return 0; } sub setConfigTreeRecursive { - my ($self, $level, @skip_list) = @_; - if (_setConfigTree($level, 0, 1, @skip_list)) { return 1; } + my ($self, $level, $skip_list, $ordered_list) = @_; + if (_setConfigTree($level, 0, 1, $skip_list, $ordered_list)) { return 1; } return 0; } sub deleteConfigTree { - my ($self, $level, @skip_list) = @_; - if (_setConfigTree($level, 1, 0, @skip_list)) { return 1; } + my ($self, $level, $skip_list, $ordered_list) = @_; + if (_setConfigTree($level, 1, 0, $skip_list, $ordered_list)) { return 1; } return 0; } sub deleteConfigTreeRecursive { - my ($self, $level, @skip_list) = @_; - if (_setConfigTree($level, 1, 1, @skip_list)) { return 1; } + my ($self, $level, $skip_list, $ordered_list) = @_; + if (_setConfigTree($level, 1, 1, $skip_list, $ordered_list)) { return 1; } return 0; } ### End Public methods - ### Private methods +sub _pdebug { + my ($level, $msg) = @_; + + if (! defined $level) { return 0; } + if ($_DEBUG >= $level) { print "DEBUG: $msg\n"; } + return 1; +} + # traverse the set/delete trees and send commands to quagga # set traverses from $level in tree top down. # delete traverses from bottom up in tree to $level. @@ -129,11 +141,18 @@ sub deleteConfigTreeRecursive { # input: $1 - level of the tree to start at # $2 - delete bool # $3 - recursive bool -# $4 - arrays of strings to skip +# $4 - array of strings to skip +# $5 - array of strings to order the input to quagga # output: none, return failure if needed sub _setConfigTree { - my ($level, $delete, $recurse, @skip_list) = @_; + my ($level, $delete, $recurse, $skip, $ordered) = @_; my $qcom = $_qcomref; + my @com_array = (); + my @skip_list = (); + my @ordered_list = (); + + if (defined $skip) { @skip_list = @$skip; } + if (defined $ordered) { @ordered_list = @$ordered; } if ((! defined $level) || (! defined $delete) || @@ -150,23 +169,19 @@ sub _setConfigTree { $sortfunc = \&cmpb; } - if ($_DEBUG >= 3) { - print "DEBUG: _setConfigTree - enter - level: $level\tdelete: $delete\trecurse: $recurse\tskip: "; - foreach my $key (@skip_list) { print "$key "; } - print "\n"; - } + _pdebug(3, "_setConfigTree - enter - level: $level\tdelete: $delete\trecurse: $recurse\tskip: @skip_list\tordered_list: @ordered_list"); - # This loop walks the list of commands and sends to quagga if appropriate - foreach my $key (sort $sortfunc keys %$vtyshref) { - if ($_DEBUG >= 3) { print "DEBUG: _setConfigTree - key $key\n"; } + # This loop walks the arrays of quagga commands and builds list to send to quagga + foreach my $key (keys %$vtyshref) { + _pdebug(3, "_setConfigTree - key $key"); - # skip parameters in skip_list + # skip parameters listed in skip_list my $found = 0; if ((scalar @skip_list) > 0) { foreach my $node (@skip_list) { if ($key =~ /$node/) { $found = 1; - if ($_DEBUG >= 3) { print "DEBUG: _setConfigTree - key $node in skip list\n"; } + _pdebug(3, "_setConfigTree - key $node in skip list"); } } } @@ -180,12 +195,12 @@ sub _setConfigTree { (($qcom->{$key}->{'noerr'} eq "set") && (!$delete)))) { $noerr = 1; } # this conditional matches key to level exactly or if recurse, start of key to level - if ((($recurse) && ($key =~ /^$level/)) || ((! $recurse) && ($key =~ /^$level$/))) { + if ((($recurse) && ($key =~ /^$level/)) || ((! $recurse) && ($key =~ /^$level$/))) { my $index = 0; foreach my $cmd (@{$vtyshref->{$key}}) { - if ($_DEBUG >= 2) { print "DEBUG: _setConfigTree - key: $key \t cmd: $cmd\n"; } - - if (! _sendQuaggaCommand("$cmd", "$noerr")) { return 0; } + _pdebug(2, "_setConfigTree - key: $key \t cmd: $cmd"); + + push @com_array, "$cmd \036 $noerr"; # remove this command so we don't hit it again in another Recurse call delete ${$vtyshref->{$key}}[$index]; $index++; @@ -193,6 +208,29 @@ sub _setConfigTree { } } + # Now let's sort based on ordered_list + my $index = 0; + while (scalar @ordered_list > 0) { + my $prio = shift @ordered_list; + my $str = sprintf "%5d", $index; + foreach my $line (@com_array) { + # add sorting order meta-data to list + $line =~ s/$prio/$str\:::$prio/; + } + $index++; + } + + # and now send the commands to quagga + foreach my $line (sort $sortfunc @com_array) { + my ($order, $command, $noerr); + + # remove the ordered_list sorting meta-data + $line =~ s/\s+\d+:::/ /; + # split our commands into individual components + ($order, $command, $noerr) = split / \036 /, $line; + if (! _sendQuaggaCommand("$command", "$noerr")) { return 0; } + } + return 1; } @@ -209,7 +247,7 @@ sub _sendQuaggaCommand { my @arg_array = ("$_vtyshexe"); if ($noerr) { push (@arg_array, '--noerr'); } - if ($_DEBUG >= 2) { push (@arg_array, '-E'); } + if (returnDebugLevel() >= 2) { push (@arg_array, '-E'); } push (@arg_array, '-c'); push (@arg_array, 'configure terminal'); @@ -234,7 +272,7 @@ sub _logger { push (@logger_cmd, "-i"); push (@logger_cmd, "-t vyatta-cfg-quagga"); - if ($_DEBUG) { push (@logger_cmd, "-s"); } + if (returnDebugLevel() > 0) { push (@logger_cmd, "-s"); } push (@logger_cmd, "@{$error_array} failed: $?"); system(@logger_cmd) == 0 or die "unable to log system error message."; @@ -251,10 +289,8 @@ sub _qVarReplace { my $node = shift; my $qcommand = shift; - if ($_DEBUG >= 2) { - print "DEBUG: _qVarReplace entry: node - $node\n"; - print "DEBUG: _qVarReplace entry: qcommand - $qcommand\n"; - } + _pdebug(2, "_qVarReplace entry: node - $node\n_qVarReplace entry: qcommand - $qcommand"); + my @nodes = split /\s/, $node; my @qcommands = split /\s/, $qcommand; @@ -293,9 +329,7 @@ sub _qVarReplace { # remove leading space characters $result =~ s/^\s(.+)/$1/; - if ($_DEBUG >= 2) { - print "DEBUG: _qVarReplace exit: result - $result\n"; - } + _pdebug(2, "_qVarReplace exit: result - $result"); return $result; } @@ -378,12 +412,12 @@ sub _qtree { } ## end else { - if ($_DEBUG) { print "DEBUG: _qtree - action: $action\tlevel: $level\n"; } + _pdebug(1, "_qtree - action: $action\tlevel: $level"); # traverse the Vyatta config tree and translate to Quagga commands where apropos if (@nodes > 0) { foreach my $node (@nodes) { - if ($_DEBUG >= 2) { print "DEBUG: _qtree - foreach node loop - node $node\n"; } + _pdebug(2, "_qtree - foreach node loop - node $node"); # for set action, need to check that the node was actually changed. Otherwise # we end up re-writing every node to Quagga every commit, which is bad. Mmm' ok? @@ -401,22 +435,22 @@ sub _qtree { if ($action eq 'set') { my $tmplhash = $config->parseTmplAll($node); if ($tmplhash->{'multi'}) { - if ($_DEBUG > 2) { print "DEBUG: multi\n"; } + _pdebug(2, "multi"); @vals = $config->returnValues($node); } else { - if ($_DEBUG > 2) { print "DEBUG: not a multi\n"; } + _pdebug(2, "not a multi"); $vals[0] = $config->returnValue($node); } } else { my $tmplhash = $config->parseTmplAll($node); if ($tmplhash->{'multi'}) { - if ($_DEBUG > 2) { print "DEBUG: multi\n"; } + _pdebug(2, "multi"); @vals = $config->returnOrigValues($node); } else { - if ($_DEBUG > 2) { print "DEBUG: not a multi\n"; } + _pdebug(2, "not a multi"); $vals[0] = $config->returnOrigValue($node); } } @@ -425,19 +459,15 @@ sub _qtree { if (defined $vals[0]) { foreach my $val (@vals) { my $var = _qVarReplace("$level $node $val", $qcom->{$qcommand}->{$action}); - push @{$vtysh->{"$qcommand"}}, $var; - if ($_DEBUG) { - print "DEBUG: _qtree leaf node command: set $level $action $node $val \n\t\t\t\t\t$var\n"; - } + push @{$vtysh->{"$qcommand"}}, "$level $node $val \036 $var"; + _pdebug(1, "_qtree leaf node command: set $level $action $node $val \n\t\t\t\t\t$var"); } } else { my $var = _qVarReplace("$level $node", $qcom->{$qcommand}->{$action}); - push @{$vtysh->{"$qcommand"}}, $var; - if ($_DEBUG) { - print "DEBUG: _qtree node command: set $level $action $node \n\t\t\t\t$var\n"; - } + push @{$vtysh->{"$qcommand"}}, "$level $node \036 $var"; + _pdebug(1, "_qtree node command: set $level $action $node \n\t\t\t\t$var"); } } } diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 22e8aa9e..383f085a 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1070,11 +1070,13 @@ was_iBGP_peer($neighbor, $as) if ($wasiBGPpeer); exit 0; -# Make sure the peer IP is properly formatted +# Make sure the peer IP isn't a local system IP sub check_neighbor_ip { my $neighbor = shift; - exit 1 if ! is_ip_v4_or_v6($neighbor); + die "Can't set neighbor address to local system IP.\n" + if (is_local_address($neighbor)); + exit 0; } @@ -1096,7 +1098,7 @@ sub check_peergroup_name { } # Make sure we aren't deleteing a peer-group that has -# neighbors configured to us it +# neighbors configured to it sub check_for_peer_groups { my $config = new Vyatta::Config; my $pg = shift; @@ -1374,46 +1376,17 @@ sub main { # and that migrations to/from iBGP eBGP are valid check_remote_as(); - # deletes with priority - # delete everything in neighbor except for the important nodes - my @skip_array = ('remote-as', 'route-map', 'filter-list', 'prefix-list', 'distribute-list', 'unsuppress-map'); + ## deletes with priority + # delete everything in neighbor, ordered nodes last + my @ordered = ('remote-as', 'shutdown', 'route-map', 'prefix-list', 'filter-list', 'distribute-list', 'unsuppress-map'); # notice the extra space in the level string. keeps the parent from being deleted. - $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n"; - # now delete everything in neighbor except remote-as - @skip_array = ('remote-as'); - $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n"; - # now finish off neighbor - $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var') || die "exiting $?\n"; - # now delete everything in peer-group except remote-as - @skip_array = ('remote-as'); - $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ', @skip_array) || die "exiting $?\n"; - # now finish off peer-group - $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ') || die "exiting $?\n"; - # now delete everything else in the tree + $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', undef, \@ordered) || die "exiting $?\n"; + $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ', undef, \@ordered) || die "exiting $?\n"; $qconfig->deleteConfigTreeRecursive('protocols bgp') || die "exiting $?\n"; - # sets with priority + ## sets with priority $qconfig->setConfigTreeRecursive('protocols bgp var parameters') || die "exiting $?\n"; - $qconfig->setConfigTree('protocols bgp var peer-group var remote-as') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var peer-group') || die "exiting $?\n"; - $qconfig->setConfigTree('protocols bgp var neighbor var remote-as') || die "exiting $?\n"; - $qconfig->setConfigTree('protocols bgp var neighbor var peer-group') || die "exiting $?\n"; - $qconfig->setConfigTree('protocols bgp var neighbor var shutdown') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var route-map') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var filter-list') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var prefix-list') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var distribute-list') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var unsuppress-map') || die "exiting $?\n"; - $qconfig->setConfigTreeRecursive('protocols bgp var neighbor') || die "exiting $?\n"; + $qconfig->setConfigTreeRecursive('protocols bgp var peer-group', undef, \@ordered) || die "exiting $?\n"; + $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var ', undef, \@ordered) || die "exiting $?\n"; $qconfig->setConfigTreeRecursive('protocols bgp') || die "exiting $?\n"; - - # old priorities we are emulating with the above sets - #705 protocols bgp var neighbhor shutdown - #715 protocols bgp var neighbhor route-map - #716 protocols bgp var neighbhor filter-list - #717 protocols bgp var neighbhor prefix-list - #718 protocols bgp var neighbhor distribute-list - #719 protocols bgp var neighbhor unsuppress-map - #720 protocols bgp var neighbhor - #730 protocols bgp var } diff --git a/templates/protocols/bgp/node.def b/templates/protocols/bgp/node.def index 3e9e6b51..01f75f02 100644 --- a/templates/protocols/bgp/node.def +++ b/templates/protocols/bgp/node.def @@ -7,4 +7,8 @@ val_help: u32:1-4294967294; AS number syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294 ; \ "AS number must be between 1 and 4294967294" -end: /opt/vyatta/sbin/vyatta-bgp.pl --main +end: + +if [ "$COMMIT_SIBLING_POSITION" != "LAST" ] ; then + /opt/vyatta/sbin/vyatta-bgp.pl --main +fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.def b/templates/protocols/bgp/node.tag/neighbor/node.def index 122f2f17..a41fc20d 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.def @@ -1,5 +1,5 @@ tag: -type: txt +type: ipv4, ipv6 help: BGP neighbor val_help: ipv4; BGP neighbor IP address val_help: ipv6; BGP neighbor IPv6 address diff --git a/templates/protocols/ospfv3/area/node.tag/.filter-list/node.def b/templates/protocols/ospfv3/area/node.tag/.filter-list/node.def index 791b3f5a..02729e7e 100644 --- a/templates/protocols/ospfv3/area/node.tag/.filter-list/node.def +++ b/templates/protocols/ospfv3/area/node.tag/.filter-list/node.def @@ -1,2 +1,2 @@ type: txt -help: Set filter-list +help: Filter list diff --git a/templates/protocols/ospfv3/area/node.tag/.filter-list/node.tag/node.def b/templates/protocols/ospfv3/area/node.tag/.filter-list/node.tag/node.def index 873e2435..5fa7a60c 100644 --- a/templates/protocols/ospfv3/area/node.tag/.filter-list/node.tag/node.def +++ b/templates/protocols/ospfv3/area/node.tag/.filter-list/node.tag/node.def @@ -1,4 +1,4 @@ tag: type: txt -help: Set direction of filter (in|out) +help: Direction of filter (in|out) allowed: echo "in out" diff --git a/templates/protocols/rip/network-distance/node.tag/access-list/node.def b/templates/protocols/rip/network-distance/node.tag/access-list/node.def index a7bc9a6f..3003e718 100644 --- a/templates/protocols/rip/network-distance/node.tag/access-list/node.def +++ b/templates/protocols/rip/network-distance/node.tag/access-list/node.def @@ -1,3 +1,3 @@ type: txt -help: Set access list +help: Access list commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $VAR(@)\" ";"access-list $VAR(@) doesn't exist" diff --git a/templates/protocols/rip/timers/garbage-collection/node.def b/templates/protocols/rip/timers/garbage-collection/node.def index b482ded1..a88d2324 100644 --- a/templates/protocols/rip/timers/garbage-collection/node.def +++ b/templates/protocols/rip/timers/garbage-collection/node.def @@ -1,6 +1,6 @@ type: u32 default: 120 -help: Set garbage collection timer +help: Garbage collection timer syntax:expression: $VAR(@) >= 5 && $VAR(@) <= 2147483647; \ "Garbage collection timer must be between 5 and 2147483647" val_help: u32:5-2147483647; Garbage colletion time (default 120) |