]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
9 years ago'service quagga reload' should not dump so much output to the log file.
Daniel Walton [Thu, 17 Sep 2015 14:24:21 +0000 (07:24 -0700)]
'service quagga reload' should not dump so much output to the log file.
It should also check that quagga is running before attempting to do
any work.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-7486
Reviewed By: Donald Sharp
Testing Done:

Verified that 'service quagga reload' exits cleanly if quagga is not
running.  Also verified that it produces a minimal amount of log output
by default.  The user can enable --debug in /etc/init.d/quagga if they
would like to enable debug output.

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Dinesh G Dutt [Wed, 16 Sep 2015 15:39:54 +0000 (08:39 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoRemove unused variable
Dinesh G Dutt [Wed, 16 Sep 2015 15:37:00 +0000 (08:37 -0700)]
Remove unused variable

Ticket:
Reviewed By:
Testing Done:

set src checkin had an unused variable. Fixed that.

9 years agoZebra: Add IPv6 protocol filtering support & Setting Src of IPv6 routes
Donald Sharp [Wed, 16 Sep 2015 12:30:57 +0000 (05:30 -0700)]
Zebra: Add IPv6 protocol filtering support & Setting Src of IPv6 routes

This Fix fixes Compile Issues associated with commit 0aabccc0a84

Ticket: None
Reviewed by: None
Testing: Compiles Now
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
9 years agoWarn user in various max path edge cases
Donald Sharp [Wed, 16 Sep 2015 12:30:23 +0000 (05:30 -0700)]
Warn user in various max path edge cases

Ticket: CM-6680
Reviewed-by: CCR-3486
Testing: See bug

In these situations:
(A) user enters under bgp more 'maximum-paths' than zebra is compiled with
warn the user that there is a problem
(B) Zebra receives more maximum paths than what it can handle log the fact
that this happened

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
9 years agoZebra: Add IPv6 protocol filtering support & Setting Src of IPv6 routes
Dinesh G Dutt [Wed, 16 Sep 2015 06:48:00 +0000 (23:48 -0700)]
Zebra: Add IPv6 protocol filtering support & Setting Src of IPv6 routes

Ticket:
Reviewed By: CCR-3335
Testing Done: bgpsmoke, ENHE tests etc.

    Add support for filtering routes from upper layer protocols to zebra
    via route-maps for IPv6. The same functionality already existed for
    IPv4.

    In addition, add support for setting source of routes via IPv6 protocol
    map.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com>
9 years agoBGP: Display the right reason code for session reset
Daniel Walton [Wed, 16 Sep 2015 02:14:06 +0000 (19:14 -0700)]
BGP: Display the right reason code for session reset

Ticket: CM-7439
Reviewed By: Donald Sharp
Testing Done:

If a session was reset due to a NOTIFICATION the "show ip bgp
neighbor" output would not display details on what the
notification actually was.  This patch changes that.  Example:

superm-redxp-05# show ip bgp neighbors 20.1.2.2
BGP neighbor is 20.1.2.2, remote AS 21, local AS 10, external link
[snip]
  Last reset 01:05:07, due to NOTIFICATION sent (OPEN Message Error/Bad Peer AS)

9 years agoquagga netlink buffer size increase
Donald Sharp [Fri, 11 Sep 2015 12:44:31 +0000 (05:44 -0700)]
quagga netlink buffer size increase

Ticket: CM-7380
Reviewed-by: CCR-3478
Testing: See Bug

This is a fix to allow the netlink buffer size to grow to a reasonable number
over the current 4mb choosen.  This number was choosen by running some
smoke tests that would fail and experimenting to find a number that worked
with those tests and then adding some headroom to that number.

This is a bit of a temporary fix due to timelines instead of the real fix
which is to write the code to properly recover from a netlink buffer overflow.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
9 years agobgpd: Exchange hostname capability and display hostnames in output
Daniel Walton [Fri, 11 Sep 2015 03:10:16 +0000 (20:10 -0700)]
bgpd: Exchange hostname capability and display hostnames in output

This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Ticket: CM-5660
Reviewed By: CCR-2563
Testing Done:

9 years agoFix arm compilation failures of sockunion_hash issues
Donald Sharp [Tue, 8 Sep 2015 23:18:30 +0000 (16:18 -0700)]
Fix arm compilation failures of sockunion_hash issues

Compiling for the arm platform with -Werror for the 9196caf commit
causes it to fail.  This commit addresses this issue

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Tue, 8 Sep 2015 20:30:13 +0000 (13:30 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoFix arm compilation failures of sockunion_hash issues
Donald Sharp [Tue, 8 Sep 2015 20:26:57 +0000 (13:26 -0700)]
Fix arm compilation failures of sockunion_hash issues

Compiling for the arm platform with -Werror for the 9196caf commit
causes it to fail.  This commit addresses this issue

9 years agolib: fix "sockunion: add hash function" for BSD (9196caf)
David Lamparter [Wed, 20 May 2015 20:34:56 +0000 (22:34 +0200)]
lib: fix "sockunion: add hash function" for BSD (9196caf)

The sockunion_hash() function uses s6_addr32, which is not defined on
BSD systems.  (It only works on glibc because we set _GNU_SOURCE)

ripngd/ripng_nexthop.h already contains a workaround for this.  Bump
workaround to prefix.h so it's available everywhere.

Reported-by: NetDEF CI System <mwinter@netdef.org>
Fixes: 9196caf ("sockunion: add hash function")
Cc: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
9 years agosockunion: add hash function
Timo Teräs [Wed, 29 Apr 2015 06:43:05 +0000 (09:43 +0300)]
sockunion: add hash function

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
9 years agoOSPFv3: Do not display default network type.
vivek [Tue, 8 Sep 2015 18:25:57 +0000 (11:25 -0700)]
OSPFv3: Do not display default network type.

Ticket: CM-3917
Reviewed By: CCR-3454
Testing Done: Manual verification

9 years agoFix bgp_exit crash
Donald Sharp [Tue, 8 Sep 2015 13:24:21 +0000 (06:24 -0700)]
Fix bgp_exit crash

Ticket: CM-7358
Reviewed-by: CCR-3462
Testing: See bug

9 years agoBgpd: aspath json memory leak fix
Donald Sharp [Thu, 3 Sep 2015 18:26:36 +0000 (11:26 -0700)]
Bgpd: aspath json memory leak fix

Ticket: CM-6790
Reviewed by: CCR-3453
Testing: See bug

This code change fixes these things:

(a) Fixes an assert followed by an if statement
(B) Fixes the memory leak in aspath->json

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Thu, 3 Sep 2015 13:50:41 +0000 (06:50 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoFix neighbor coming up without an as specified
Donald Sharp [Thu, 3 Sep 2015 13:50:16 +0000 (06:50 -0700)]
Fix neighbor coming up without an as specified

Ticket: CM-7012
Reviwed by: CCR-3451
Testing: See bug

When you specify a neighbor <interface> <something>
and don't specify a remote-as the neighbor relationship
will still come up with ipv6 unnumbered if you have
RA configured on the interface.

9 years agoZebra: Fix log related to delete notification for IPv6 route
vivek [Wed, 2 Sep 2015 23:43:33 +0000 (16:43 -0700)]
Zebra: Fix log related to delete notification for IPv6 route

Ticket: CM-7204
Reviewed By: CCR-3449
Testing Done: Verified the log manually

Port of patch zebra-fix-ipv6-route-delete-log.patch from 2.5-br

9 years agoMultiple redistribute commands with different metric fail
Donald Sharp [Wed, 2 Sep 2015 14:36:50 +0000 (07:36 -0700)]
Multiple redistribute commands with different metric fail

Ticket: CM-7339
Reviewed-by: CCR-3446
Testing: Test Suite passes now

The bgp_redistribute_metric_set function was not
taking into account the table # for deciding
what metric to set.

9 years agoFix some more memory issues in Quagga
Donald Sharp [Wed, 2 Sep 2015 12:19:44 +0000 (05:19 -0700)]
Fix some more memory issues in Quagga

Ticket: CM-4109
Reviewed-by: CCR-3414
Testing: See bug

Fixup of these memory issues:

(A) peer->clear_node_queue was accidently removed.  Add back in.
(B) Clean up bm->process_main_queue and bm->process_rsclient_queue initialization
(C) Some memory leaks
(D) Clean up unused threads

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Tue, 1 Sep 2015 19:47:04 +0000 (12:47 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoFix dryrun capability to output line # of failed read
Donald Sharp [Tue, 1 Sep 2015 19:46:08 +0000 (12:46 -0700)]
Fix dryrun capability to output line # of failed read

Ticket: CM-6856
Reviewed by: CCR-3431
Testing: See bug

9 years agolib: Improve error reporting from broken config files
Steve Hill [Tue, 28 Jul 2009 20:36:14 +0000 (16:36 -0400)]
lib: Improve error reporting from broken config files

* command.h: (config_from_file) Add variable to interface for line
      number reporting.
    * command.c: (config_from_file) Set & increment 'line_num' while parsing.
    * vty.c: (vty_read_file) Report parse errors in the correct order to
      stderr, with added line numbers.

Conflicts:
lib/command.c
lib/vty.c

Integrated in changes made to continue loading code even after failure
to read a line in properly as part of this cherry-pick

9 years ago'service quagga reload' is no longer experimental
Daniel Walton [Tue, 1 Sep 2015 16:58:50 +0000 (09:58 -0700)]
'service quagga reload' is no longer experimental

Ticket: CM-7305
Reviewed By: sharpd@cumulusnetworks.co
Testing Done:

9 years agoSupport of BFD status in Quagga
radhika [Mon, 31 Aug 2015 21:56:11 +0000 (14:56 -0700)]
Support of BFD status in Quagga

Ticket:CM-6802, CM-6952
Reviewed By: Donald, Kanna
Testing Done:

Double commit of b76943235e09472ec174edcf7204fc82d27fe966 from br2.5. But, manually resolved all the compilation errors. Also, modified the shows to support the json format which was not supported in br2.5.

CM-6802 – Currently, BFD session status can be monitored only through ptmctl. There is no way to check the BFD status of a peer/neighbor through Quagga. Debugging becomes easier if BFD status is shown in Quagga too. BFD status is relevant when it is shown against the BGP peer/OSPF neighbor. For, this following code changes have been done:
   - Only down messages from PTM were being propagated from Zebra daemon to clients (bgpd, ospfd and ospf6d). Now, both up and down messages are redistributed to the clients from zebra. BFD status field has been added to the messaging. Handling of BFD session up messages has been added to the client code. BGP/OSPF neighbor is brought down only if the old BFD session status is ‘Up’ to handle extra/initial down messages.
   - BFD status and last update timestamp fields have been added to the common BFD info structure. Also, common show functions for showing BFD information have been added to BFD lib.
   - Modified the BGP neighbor show functions to call common BFD lib functions.
   - For ospf and ospf6, BFD information was maintained only at interface level. To show BFD status per neighbor, BFD information has been added at neighbor level too. “show ip ospf interface”, “show ip ospf neighbor detail”, “show ipv6 ospf6 interface” and “show ipv6 ospf6 neighbor detail” output have been modified to show BFD information.

CM-6952 - IBGP peers were always assumed to be multi-hop since there was no easy way to determine whether an IBGP peer was single hop or multihop unlike EBGP. But, this is causing problem with IBGP link local peers since BFD doesn't allow multihop BFD session with link local IP addresses. Link local peers were discovered when the interface peering was enabled. Interface peering is always singlehop. So, added checks to treat all interface based peers as single hop irrespective of whether the peer is IBGP or EBGP.

9 years agoBGP: Fix MD5 authentication for unnumbered neighbors
vivek [Sat, 29 Aug 2015 23:10:12 +0000 (16:10 -0700)]
BGP: Fix MD5 authentication for unnumbered neighbors

Ticket: CM-6369
Reviewed By: CCR-3318
Testing Done: Manual testing of various password scenarios.

This is a port of patch bgpd-unnumbered-nbr-fix-password.patch from
2.5-br.

In the case of BGP unnumbered, the peer IP address is derived and not
explicitly configured. If there is a password configured for the peer,
it can be set on the listen socket only after the IP address has been
derived and needs to be cleared when the IP address goes away.

9 years agoBGP: Do not error upon duplicate listen range
vivek [Sat, 29 Aug 2015 18:54:41 +0000 (11:54 -0700)]
BGP: Do not error upon duplicate listen range

Ticket: CM-6517
Reviewed By: Trivial
Testing Done: Manual testing in 2.5-br

This commit is a port of the patch bgpd-dynamic-nbr-fix-config-error.patch
from 2.5-br.

9 years agoBGP: Handle interface or local address failure
vivek [Sat, 29 Aug 2015 18:40:32 +0000 (11:40 -0700)]
BGP: Handle interface or local address failure

Ticket: CM-6883
Reviewed By: CCR-3272
Testing Done: Tested on 2.5.3-SE-1

This commit is a port of the patch bgpd-handle-peer-local-address-failure.patch
from 2.5-br.

When a peering is being established, the IPv4 and IPv6 addresses of the
local end of the connection, as applicable, are obtained and stored in
the peer's 'nexthop' structure to facilitate filling of the NEXT_HOP
field in Update messages among other things. The process of obtaining the
local address involves examination of the list of interfaces to identify
a match corresponding to the socket address of the connection.

There are timing conditions, especially when BGPD starts with a config,
where the interface may not have reached BGP from Zebra at the time a
peering reaches the state to determine the local addresses. The code does
not handle this well and the result could be Updates generated with bad
(Martian) NEXT_HOP values. Resolve the issue by bringing down the connection
in this case as not identifying the local addresses is really an error.

9 years agoRemoving neighbor command is silently ignored if interface v6only option
Daniel Walton [Thu, 27 Aug 2015 20:03:11 +0000 (13:03 -0700)]
Removing neighbor command is silently ignored if interface v6only option
is used

Ticket: CM-6505
Reviewed By: Vivek
Testing Done:

The 'no' for this command was missing the {v6only} at the end

9 years agoFix for PTM cable status change notification not being handeled in Zebra
radhika [Wed, 26 Aug 2015 19:37:46 +0000 (12:37 -0700)]
Fix for PTM cable status change notification not being handeled in Zebra

Ticket: CM-6690
Reviewed By: Donald, Kanna
Testing Done:

Double commit of 4bbc0cf4a98d7fd2aabe47241424fa7c5a3ae1eb from br2.5 to master

PTM cable status updates were not being handled in the notification callback registered with the ptm lib. This results in interface ptm status mismatch between PTM and zebra when interface cable check status changes (pass->fail or fail->pass). Zebra requests PTM to send cable status updates using get-status command and PTM sends the cable status updates as command responses to get-status. This was being handled in the commmand response callback registered with ptm lib. But, the subsequent status updates come as notifications and handling of those notifications that was missing in the notification callback. Fixed the issue by making a common callback for command responses and notifications. All the command responses other than the responses to get-status are dropped/ignored.

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Dinesh G Dutt [Wed, 26 Aug 2015 17:58:56 +0000 (10:58 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoBGP: Fix warning message when interface has IPv4 address for unnumbered
Dinesh G Dutt [Wed, 26 Aug 2015 17:54:11 +0000 (10:54 -0700)]
BGP: Fix warning message when interface has IPv4 address for unnumbered

Ticket: CM-6192
Reviewed By: Donald, Daniel, Vipin
Testing Done:

In the presence of an IPv4 address that is not a /30 or /31 and the user
is trying to use BGP unnumbered, a warning message is printed which
seems confusing to the user. Fixing the warning message to indicate that
its only a v4 session isn't coming up makes it clearer.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Acked-by: Daniel Walton <dwalton@cumulusnetworks.com>
Acked-by: Vipin Kumar <vipin@cumulusnetworks.com>
9 years agoFix dynamic sessions with multiple bgp instances
Donald Sharp [Wed, 26 Aug 2015 16:03:30 +0000 (09:03 -0700)]
Fix dynamic sessions with multiple bgp instances

Ticket:CM-6534
Reviewed by:CCR-3239
Testing: See Bug

Dynamic neighbors did not work properly with multiple bgp instances.
This was caused by the lookup for the dynamic range attempting to
break out of two for loops at the same time.  The break only stopped
the innermost for loop, causing it to only ever find the listen-range
for the last instance in the bm->bgp list.

Additional bug fix for dynamic listen for peer groups that are configured
with internal or external key word.

9 years agoFix optional arguments with description interactions
Donald Sharp [Wed, 26 Aug 2015 16:01:31 +0000 (09:01 -0700)]
Fix optional arguments with description interactions

Ticket: CM-6659
Reviewed by: CCR-3203
Testing: See bug

If you have a cli like this:
"neighbor WORD interface {v6only}"

When in the cli you hit ? after entering v6only you get this:

tor-11(config-router)# neighbor swp1 interface v6only
% There is no matched command.
tor-11(config-router)# neighbor swp1 interface v6only

With this fix we now see:
tor-22(config-router)# neighbor swp1 interface v6only
<cr>
tor-22(config-router)# neighbor swp1 interface v6only

This behavior is now consistent with non-optional last
arguments.

9 years agoFixup code to use correct XMALLOC operators
Donald Sharp [Wed, 26 Aug 2015 14:44:57 +0000 (07:44 -0700)]
Fixup code to use correct XMALLOC operators

Ticket: CM-7177
Reviewed-by: CCR-3396
Testing: See bug

This code change does several small things:
(A) Fix a couple detected memory leaks
(B) Fix all malloc operations to use the correct XMALLOC operation in bgpd and parts of lib
(C) Adds a few new memory types to make it easier to detect issues

9 years agoCreate override for quagga reinstall of originated routes
Donald Sharp [Wed, 26 Aug 2015 12:21:40 +0000 (05:21 -0700)]
Create override for quagga reinstall of originated routes

Ticket: CM-7026
Reviewed by: CCR-3315
Testing: See bug

Quagga-dev suggested these changes for the quagga override of originated routes.

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Mon, 24 Aug 2015 17:50:43 +0000 (10:50 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoFix watchquagga to watch just one daemon
Donald Sharp [Mon, 24 Aug 2015 17:50:21 +0000 (10:50 -0700)]
Fix watchquagga to watch just one daemon

Ticket: CM-6669
Reviewed by: CCR-3249
Testing: See Bug

I believe in the past it made no sense to have only 1 quagga daemon running(zebra),
since it would just handle interface configuration and static routes, both of which
would be better handled through the linux cli.

Now that we have added recursive static routes and the ability to handle static
mpls labels to zebra, there are use cases where zebra would be the only be running.

This change allows watchquagga to behave with this setup.

9 years ago'service quagga reload' fails if /etc/quagga/vtysh.conf does not exist
Daniel Walton [Thu, 20 Aug 2015 20:55:32 +0000 (13:55 -0700)]
'service quagga reload' fails if /etc/quagga/vtysh.conf does not exist

Ticket: CM-7146
Reviewed By: teo@cumulusnetworks.com
Testing Done:

/usr/lib/quagga/quagga-reload.py needs to check that
/etc/quagga/vtysh.conf exists before trying to open it

9 years agoAdd missing vtysh commands
Donald Sharp [Thu, 20 Aug 2015 01:33:13 +0000 (18:33 -0700)]
Add missing vtysh commands

Ticket: CM-7135
Reviewed-by: CCR-3367
Testing: See Bug

The commands 'show work-queues' and 'show thread cpu X' were missing
from vtysh but available from the telnet cli.

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Morgan Stewart [Wed, 19 Aug 2015 16:51:18 +0000 (09:51 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agobgpd: Remove extra stream duplications
Donald Sharp [Tue, 18 Aug 2015 12:41:58 +0000 (05:41 -0700)]
bgpd: Remove extra stream duplications

Ticket: CM-7104
Reviewed by: CCR-3347
Tested:  See bug

Remove the extra stream duplications in packet handling for bgpd

9 years agoRemove unused 'show memory XXX' functionality
Donald Sharp [Tue, 18 Aug 2015 12:29:01 +0000 (05:29 -0700)]
Remove unused 'show memory XXX' functionality

The 'show memory XXXX' functionality is not used at all.
This removes the unused code.

9 years agoQuagga: Restrict Shell Access
Donald Sharp [Wed, 12 Aug 2015 23:11:07 +0000 (16:11 -0700)]
Quagga: Restrict Shell Access

Ticket: CM-6926
Reviewed By: CCR-3328
Tested: See bug

Restrict Shell access to those people who intentionally turn it on.
As that it can be used as a exploit to elevate permissions

9 years agoAdded json formating support to show-...-neighbors-... bgp commands.
Morgan Stewart [Wed, 12 Aug 2015 13:59:18 +0000 (06:59 -0700)]
Added json formating support to show-...-neighbors-... bgp commands.

Ticket: CM-6789
Reviewed By: CCR-3263
Testing Done: Manual Testing and smoke tests

Whenever some sort of output is encountered, added a json version with
proper logic as well.

9 years agoReplace lists with arrays to store read and write threads
Denil Vira [Tue, 11 Aug 2015 20:14:40 +0000 (13:14 -0700)]
Replace lists with arrays to store read and write threads

Ticket : CM-6300
Reviewed by : CCR-3049
Testing : Manual

With arrays, a thread corresponding to given fd is looked up in constant time
versus the linear time taken for list traversals.

9 years agoFix memory leak in bgpd/bgp_route.c
Denil Vira [Tue, 11 Aug 2015 18:31:52 +0000 (11:31 -0700)]
Fix memory leak in bgpd/bgp_route.c

Ticket : CM-7047
Reviewed by : CCR-3321
Testing : Trivial

In function bgp_aggregate_add, variables 'aspath' and 'community' are
malloced but not guaranteed to be freed before the function returns.

9 years agoFix memory leak in lib/routemap.c
Denil Vira [Tue, 11 Aug 2015 15:43:00 +0000 (08:43 -0700)]
Fix memory leak in lib/routemap.c

Ticket : CM-7047
Reviewed-by : CCR-3320
Testing : See Bug

9 years agoVariable reuse in bgpd.c
Denil Vira [Tue, 11 Aug 2015 15:35:52 +0000 (08:35 -0700)]
Variable reuse in bgpd.c

Ticket : CM-7004
Reviewed by : CCR-3314
Testing : Trivial

In bgp_delete(), variables 'node' and 'next' are overwritten in
the nested for loop.

9 years agoAdded json formating support to several show-...-detail ospf commands.
Morgan Stewart [Fri, 7 Aug 2015 18:16:18 +0000 (11:16 -0700)]
Added json formating support to several show-...-detail ospf commands.

Ticket: CM-6520
Reviewed By: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed By: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-By: Morgan Stewart <morgan@cumulusnetworks.com>
Testing Done: Manual testing and smoketested

Whenever some sort of output is encountered, added a json version with
proper logic as well.

9 years agoconfiguration options for faster OSPF convergence
Michael Rossberg [Mon, 27 Jul 2015 19:05:44 +0000 (21:05 +0200)]
configuration options for faster OSPF convergence

Allow configuration of faster OSPF convergence via the
min_ls_interval and min_ls_arrival timer lengths.

This patch was originated by Michael, and cross-ported
to Cumulus's Quagga.

Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
9 years agoFix redistribute metric change not taking effect
Donald Sharp [Fri, 31 Jul 2015 12:53:12 +0000 (05:53 -0700)]
Fix redistribute metric change not taking effect

Ticket: CM-6048
Reviewed-By: CCR-3251
Tested: See bug

When a redistribute metric is changed, the new metric
was not being used.  Modify the code to look for existing
redistributed routes and fix their metric.

9 years agoarm compilation failures.
Donald Sharp [Wed, 29 Jul 2015 23:02:26 +0000 (16:02 -0700)]
arm compilation failures.

Ticket: Trivial
Reviewed by: Trivial
Testing: arm/powerpc/amd64 targets now build

Apparently we have a arm build.  Who knew?  This fixes the compile warnings/errors
produced when you compile a arm build with -Werror.

9 years agoEnable debugs in quagga-reload
Daniel Walton [Tue, 28 Jul 2015 03:43:32 +0000 (03:43 +0000)]
Enable debugs in quagga-reload

Ticket: CM-6695
Reviewed By: Donald
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>

9 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Daniel Walton [Tue, 28 Jul 2015 03:31:35 +0000 (20:31 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

9 years agoQuagga processes should not die if they read an unrecognized line in
Daniel Walton [Tue, 28 Jul 2015 03:30:22 +0000 (20:30 -0700)]
Quagga processes should not die if they read an unrecognized line in
their config file

Ticket: CM-6738
Reviewed By: Donald and Dinesh
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>

9 years agoFixup compiler warnings for powerpc
Donald Sharp [Mon, 27 Jul 2015 20:19:12 +0000 (13:19 -0700)]
Fixup compiler warnings for powerpc

The turn-on of -Werror was never run fully against powerpc.
there were some powerpc specific issues that turned up.
This commit fixes these issues.

9 years agoUpdated .gitignore to ignore the files that are created when you build the debian...
Daniel Walton [Mon, 27 Jul 2015 19:11:38 +0000 (19:11 +0000)]
Updated .gitignore to ignore the files that are created when you build the debian package

9 years agoCause warnings to not build correctly in debian packaging
Donald Sharp [Sat, 25 Jul 2015 23:20:48 +0000 (16:20 -0700)]
Cause warnings to not build correctly in debian packaging

9 years agoFixup of a few missed warnings after --enable-werror turned on
Donald Sharp [Sat, 25 Jul 2015 23:13:58 +0000 (16:13 -0700)]
Fixup of a few missed warnings after --enable-werror turned on

Ticket: Trivial
Reviewed by: Trivial
Testing: Compilation

9 years agoAdd --enable-werror to configure
Donald Sharp [Sat, 25 Jul 2015 23:05:56 +0000 (16:05 -0700)]
Add --enable-werror to configure

9 years agoFixup of warnings in the code
Donald Sharp [Sat, 25 Jul 2015 22:55:47 +0000 (15:55 -0700)]
Fixup of warnings in the code

Ticket: None
Reviewed by: Trivial
Testing:

A bunch of warnings have crept in to the code base.  This
fixes the issue

9 years agoFix bugs reported by coverity scan
Denil Vira [Thu, 23 Jul 2015 15:47:21 +0000 (08:47 -0700)]
Fix bugs reported by coverity scan

1. Fix useless call in bgpd/bgp_mplsvpn.c
Coverity scan ID : 1302528. Calling "decode_label(pnt)" is only useful
for its return value, which is
ignored. Removed the call.

2. Fix logically dead code in lib/stream.c
Coverity Scan ID 1302488. Test for size==0 makes no sense, since assert
immediately before it
would not let this code happen.

3. Fix Free Pointer dereference in lib/filter.c
Coverity Scan ID 23056. access is accessed after free in
access_list_delete

9 years agoFix bgp_route.c missing code
Donald Sharp [Thu, 23 Jul 2015 00:20:41 +0000 (17:20 -0700)]
Fix bgp_route.c missing code

9 years agoSome more missing changes
Donald Sharp [Wed, 22 Jul 2015 20:21:25 +0000 (13:21 -0700)]
Some more missing changes

9 years agoCleanup of missing NEXTHOP_FORCE_SELF
Donald Sharp [Wed, 22 Jul 2015 20:18:24 +0000 (13:18 -0700)]
Cleanup of missing NEXTHOP_FORCE_SELF

9 years agoFixup of some last remaining differences between stg and git
Donald Sharp [Wed, 22 Jul 2015 20:12:22 +0000 (13:12 -0700)]
Fixup of some last remaining differences between stg and git

9 years agoptm-integration.patch
Donald Sharp [Wed, 22 Jul 2015 20:07:08 +0000 (13:07 -0700)]
ptm-integration.patch

Integrates Prescriptive Topology Module(ptm) into quagga.

If this module is enabled, link ups are notified only after the link is verified
as being connected to the neighbor specified. The neighbor specification and
checking is done by the ptm daemon.

<This is a recommit of this patch because it was changed in situ>

9 years agoFixup of peer memory leaks in bgp
Donald Sharp [Wed, 22 Jul 2015 19:35:38 +0000 (12:35 -0700)]
Fixup of peer memory leaks in bgp

When deleting a set of peers, the peer->group pointer was being set to NULL
and then passed into peer_delete.

peer_delete has functionality to safely remove the peer->group structure if it
non-null and to remove the peer->group if it's refcnt reaches zero.

This is a day one bug in the quagga source tree.

9 years agomultipath is broken if deterministic-med is enabled
Daniel Walton [Wed, 22 Jul 2015 19:35:38 +0000 (12:35 -0700)]
multipath is broken if deterministic-med is enabled

9 years agobgpd-capability-cleanup.patch
Donald Sharp [Wed, 22 Jul 2015 19:35:38 +0000 (12:35 -0700)]
bgpd-capability-cleanup.patch

BGP: Make Capability handling a little more robust

This patch does two things:
- Returns the right sub error code when a malformed capability is rcvd
- Verifies that the capability length is a multiple of an individual unit

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
9 years agoCall of quagga-reload.py does not return error code
Donald Sharp [Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)]
Call of quagga-reload.py does not return error code

9 years agoThis patch changes ospfd from only listening mode for BFD status updates to interacti...
Donald Sharp [Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)]
This patch changes ospfd from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering neighbors discovered on BFD enabled interfaces with PTM/BFD through zebra. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.

OSPF BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ip ospf bfd <detect mult> <min rx> <min tx>

This patch also adds BFD support for IPv6 OSPF. ospf6d  will dynamically register/deregister IPv6 neighbors with BFD for monitoring the connectivity of the neighbor. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.

OSPF6 BFD command added to configure BFD and parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ipv6 ospf6 bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
9 years agoWhen IPv6 peer BFD down status is received by BGP, all the the peers for which the...
Donald Sharp [Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)]
When IPv6 peer BFD down status is received by BGP, all the the peers for which the BFD is enabled are brought down. This happens due to reverse memcmp check of destination and source IPv6 addresses with the BFD enabled BGP peers. Fixed it by doing the memcmp correctly.

Also, there is no reason stored in the last_reset field when BGP peer goes down due BFD. Incorrect/no peer down reason can get logged when BGP peer goes down due to BFD. Fixed it by adding new BFD peer down reason code and storing it in the peer last_reset field when peer is broght down due to BFD.

9 years agoThe last BGP peer down reason code "PEER_DOWN_V6ONLY_CHANGE" has no corresponding...
Donald Sharp [Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)]
The last BGP peer down reason code "PEER_DOWN_V6ONLY_CHANGE" has no corresponding logging/display string defined in "peer_down_str". This will cause incorrect or empty down reason to get logged when the peer is brought down because of interface based v6only config change.

9 years agobgpd-interface-ipv4-cmd.patch
Donald Sharp [Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)]
bgpd-interface-ipv4-cmd.patch

BGP: Determine peer's IP address if interface has /30, /31

Allow interface-based session config for IPv4 numbered links
if the link address is either /30 or /31. This is not RFC5549,
but can be deployed now, and independent of whether the peer
supports RFC5549 or not.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-By: Vivek Venkataram <vivek@cumulusnetworks.com>
9 years agoquagga-fix-stop-vty.patch
Donald Sharp [Wed, 22 Jul 2015 19:35:36 +0000 (12:35 -0700)]
quagga-fix-stop-vty.patch

When stopping quagga, we do not wait for quagga to
finish shutting down before we start attempting
to delete the sockets for the various protocols.

9 years agoThe MD5 password configured for a BGP peer was incorrectly getting
Donald Sharp [Wed, 22 Jul 2015 19:35:36 +0000 (12:35 -0700)]
The MD5 password configured for a BGP peer was incorrectly getting
deleted from the listen socket in some situations. This would lead
to incorrect behavior where a BGP connection from a peer that does
not specify the MD5 option would be accepted.

9 years agowatchquagga-mode-3-fix.patch
Donald Sharp [Wed, 22 Jul 2015 19:35:36 +0000 (12:35 -0700)]
watchquagga-mode-3-fix.patch

Watchquagga: In phased restart with zebra, invoke restart all when zebra dies

To correctly handle starting and stopping of individual daemons not affecting
watchquagga's monitoring, we resorted to fixing up watchquagga's daemon watch
list every time a daemon was started or stopped. This was done by restarting
watchquagga itself. This meant the handling of phased restart of individual
daemons was broken in watchquagga as it attempted to stop daemons individually
before starting them all individually. Fix this by restarting all when this
happens. This does make mode 4 indistinguishable from mode 1, but I don't
understood the point of mode 4 and we don't think users change watchquagga
modes.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
9 years agoAdd optional json capability to the "show ip ospf neighbor", "show ip ospf neighbor...
Donald Sharp [Wed, 22 Jul 2015 19:35:36 +0000 (12:35 -0700)]
Add optional json capability to the "show ip ospf neighbor", "show ip ospf neighbor all", and "show ip ospf neighbor IFNAME" commands and whatever functions that they call.

9 years agoAdd json capability to the "show ip ospf interface [INTERFACE]" and "show ip ospf...
Donald Sharp [Wed, 22 Jul 2015 19:35:36 +0000 (12:35 -0700)]
Add json capability to the "show ip ospf interface [INTERFACE]" and "show ip ospf <1-65535> interface [INTERFACE]" commands and whatever functions that they call. Option shows up as {json}.

9 years agoAdd json capability to the ospf commands: "show ip ospf" and "show ip ospf <1-65535...
Donald Sharp [Wed, 22 Jul 2015 19:35:35 +0000 (12:35 -0700)]
Add json capability to the ospf commands: "show ip ospf" and "show ip ospf <1-65535>". Optional argument will be {json} and will output a json object with all applicable information.

9 years agoUse camelCase notation for all json keywords
Donald Sharp [Wed, 22 Jul 2015 19:35:35 +0000 (12:35 -0700)]
Use camelCase notation for all json keywords

9 years ago# This series applies on GIT commit ace4704890f1351ba5568c92bedc88c378acfeeb
Donald Sharp [Wed, 22 Jul 2015 19:34:43 +0000 (12:34 -0700)]
# This series applies on GIT commit ace4704890f1351ba5568c92bedc88c378acfeeb
bgpd-json-use-camelcase-keywords.patch
ospfd-show-ip-ospf-json.patch
ospfd-json-ospf-interface.patch
ospfd-json-ospf-neighbor.patch
watchquagga-mode-3-fix.patch
bgpd-fix-peer-password-reset.patch
quagga-fix-stop-vty.patch
bgpd-interface-ipv4-cmd-patch
bgpd-fix-v6only-config-change-down-reason.patch
bgpd-bfd-fix-peer-flap.patch
ospfx-bfd-dynamic-support.patch
quagga-reload-error.patch
bgpd-capability-cleanup.patch
bgpd-multipath-with-deterministic-med.patch
bgpd-peer-memory-leaks.patch

9 years agoRemove draft-walton-bgp-hostname-capability-00 for now
Donald Sharp [Fri, 12 Jun 2015 14:59:12 +0000 (07:59 -0700)]
Remove draft-walton-bgp-hostname-capability-00 for now

9 years agoipv6_ll_address_to_mac() fails to correctly convert fe80::a8aa:aaff:feaa:aaf8 to...
Donald Sharp [Fri, 12 Jun 2015 14:59:12 +0000 (07:59 -0700)]
ipv6_ll_address_to_mac() fails to correctly convert fe80::a8aa:aaff:feaa:aaf8 to AA:AA:AA:AA:AA:F8

9 years agobgpd-5549-display-ll-ifname.patch
Donald Sharp [Fri, 12 Jun 2015 14:59:12 +0000 (07:59 -0700)]
bgpd-5549-display-ll-ifname.patch

BGP: Display Link local addr and ifname as part of 5549 support

As part of BGP unnumbered and RFC 5549 support, the implementation will honor the
link local address as the NH if present and so it'd be useful to display that
info along with the interface name, when displaying the BGP route summary. That
is what this patch aims to do.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
9 years agobgpd-addpath-rx-cap-fix.patch
Donald Sharp [Fri, 12 Jun 2015 14:59:11 +0000 (07:59 -0700)]
bgpd-addpath-rx-cap-fix.patch

BGP: Make Addpath capability failure handling more inline with other cap.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
9 years agoBGP: Restart the BGP FSM if update source fails.
Donald Sharp [Fri, 12 Jun 2015 14:59:11 +0000 (07:59 -0700)]
BGP: Restart the BGP FSM if update source fails.

For IPv6, update source sometimes fails at the first attempt. If we continue
ignoring the error, some sessions will not come up. If instead we check for
the error and return connect_error, the FSM will reset its state and try again
till the update source bind succeeds and the session will come up.

This patch adds checking for the result of bind and update_source to return
connect_error or success. The rest of the code handles the situation correctly
after that.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
9 years agobgpd-set-somark.patch
Donald Sharp [Fri, 12 Jun 2015 14:59:11 +0000 (07:59 -0700)]
bgpd-set-somark.patch

BGP: Set SO_MARK on connecting sockets to ensure lookup in right routing table

In the presence of a function such as management VRF/MRF, bgpd needs to be able
to specify that it intends to run in the dataplane and not the front panel.
To ensure this, we add a mark in the connecting socket so that the kernel
does the routing lookup in the right table. This assumes that an appropriate
ip rule has been configured (outside the scope of this package).

While we've forced the mark to be 254 for now, it maybe required to make it
configurable at a later time.

9 years agoThis patch changes BGP from only listening mode for BFD status updates to interactive...
Donald Sharp [Fri, 12 Jun 2015 14:59:11 +0000 (07:59 -0700)]
This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.

This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop.

BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).

router bgp <as-number>
  neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
9 years agoKey changes:
Donald Sharp [Fri, 12 Jun 2015 14:59:11 +0000 (07:59 -0700)]
Key changes:

- The aspath and community structures now have a json_object where we
  store the json representation.  This is updated at the same time
  the "str" for aspath/community are updated.  We do this so that we
  do not have to compute the json rep
- Added a small wrappper to libjson0, the wrapper lives in quagga's lib/json.[ch].
- Added more structure to the json output.  Sample output:

show ip bgp summary json
------------------------
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 2400
RIB entries 4799, using 562 KiB of memory
Peers 17, using 284 KiB of memory
Peer groups 4, using 224 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4    10       0       0        0    0    0 never    Active
10.0.0.2        4    10     104       7        0    0    0 00:02:29      600
10.0.0.3        4    10     104       7        0    0    0 00:02:29      600
10.0.0.4        4    10     204       7        0    0    0 00:02:29     1200
20.1.1.6        4    20     406     210        0    0    0 00:02:44      600
20.1.1.7        4    20     406     210        0    0    0 00:02:44      600
40.1.1.2        4    40     406     210        0    0    0 00:02:44      600
40.1.1.6        4    40     406     210        0    0    0 00:02:44      600
40.1.1.10       4    40     406     210        0    0    0 00:02:44      600

Total number of neighbors 9

{
    "as": 10,
    "dynamic-peers": 0,
    "peer-count": 17,
    "peer-group-count": 4,
    "peer-group-memory": 224,
    "peer-memory": 291312,
    "peers": {
        "1.1.1.1": {
            "inq": 0,
            "msgrcvd": 0,
            "msgsent": 0,
            "outq": 0,
            "prefix-advertised-count": 0,
            "prefix-received-count": 0,
            "remote-as": 10,
            "state": "Active",
            "table-version": 0,
            "uptime": "never",
            "version": 4
        },
        "10.0.0.2": {
            "hostname": "r2",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.3": {
            "hostname": "r3",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.4": {
            "hostname": "r4",
            "inq": 0,
            "msgrcvd": 204,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 1200,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "20.1.1.6": {
            "hostname": "r6",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "20.1.1.7": {
            "hostname": "r7",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.10": {
            "hostname": "r10",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.2": {
            "hostname": "r8",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.6": {
            "hostname": "r9",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        }
    },
    "rib-count": 4799,
    "rib-memory": 575880,
    "router-id": "10.0.0.1",
    "table-version": 2400,
    "total-peers": 9
}

show ip bgp json
----------------
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.88.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.89.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i

        "40.3.88.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],
        "40.3.89.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],

show ip bgp x.x.x.x json
------------------------
BGP routing table entry for 40.3.86.0/24
Paths: (3 available, best #3, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.2 10.0.0.3 10.0.0.4 20.1.1.6 20.1.1.7 40.1.1.2 40.1.1.6 40.1.1.10
  100 200 300 400 500 40
    40.1.1.6 from 40.1.1.6 (40.0.0.9)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.10 from 40.1.1.10 (40.0.0.10)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.2 from 40.1.1.2 (40.0.0.8)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

{
    "advertised-to": {
        "10.0.0.2": {
            "hostname": "r2"
        },
        "10.0.0.3": {
            "hostname": "r3"
        },
        "10.0.0.4": {
            "hostname": "r4"
        },
        "20.1.1.6": {
            "hostname": "r6"
        },
        "20.1.1.7": {
            "hostname": "r7"
        },
        "40.1.1.10": {
            "hostname": "r10"
        },
        "40.1.1.2": {
            "hostname": "r8"
        },
        "40.1.1.6": {
            "hostname": "r9"
        }
    },
    "paths": [
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.6",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r9",
                "peer-id": "40.1.1.6",
                "router-id": "40.0.0.9",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.10",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r10",
                "peer-id": "40.1.1.10",
                "router-id": "40.0.0.10",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "bestpath": {
                "overall": true
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.2",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r8",
                "peer-id": "40.1.1.2",
                "router-id": "40.0.0.8",
                "type": "external"
            },
            "valid": true
        }
    ],
    "prefix": "40.3.86.0",
    "prefixlen": 24
}

9 years agoBGP: bestpath needs to prefer confed-external over confed-internal
Donald Sharp [Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)]
BGP: bestpath needs to prefer confed-external over confed-internal

Topology:
                    +-----------------------------------------+
                    |                                         |
                    |                 AS 100                  |
                    |                                         |
                    |  +----------------+                     |
  +-----------+     |  |                |                     |
  |           |     |  |   SubAS 65001  |                     |
  |   AS 90   |     |  |                |    +-------------+  |
  |    r9----------------r1---------r2----\  |             |  |
  |     |     |     |  |  |         |   | |  | SubAS 65002 |  |
  +-----|-----+     |  |  \--- r3 --/   | \-------r4       |  |
        \---------------------/  \---------------/ |       |  |
                    |  |                |    |     |       |  |
                    |  +----------------+    |     |       |  |
                    |                        |     |       |  |
                    |  +----------------+    |    r5       |  |
  +-----------+     |  |                |    |     |       |  |
  |           |     |  |   SubAS 65003  |    +-----|-------+  |
  |   AS 80   |     |  |                |          |          |
  |    r8----------------r7--------r6--------------/          |
  |           |     |  |                |                     |
  +-----------+     |  +----------------+                     |
                    +-----------------------------------------+

Important info:
- r8 originates 8.8.8.8/32
- r1, r2, r3 -> r7 are 10.0.0.1, 10.0.0.2, etc
- 'bgp bestpath compare-routerid' is configured everywhere (we could still hit
  the problem without this though)

Bestpath selection for 8.8.8.8/32 on r2 and r3 is inconsistent. Here r4
advertised the 8.8.8.8/32 to r2 first, r2 then advertised it to r3, r3 selected
the path from r2 as the bestpath due to lowest router-id.

r2
BGP routing table entry for 8.8.8.8/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.1 10.0.0.3 10.0.0.4
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best
      Last update: Fri May  1 14:46:57 2015

r3
BGP routing table entry for 8.8.8.8/32
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.4 90.1.1.6
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.2 (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Last update: Fri May  1 14:46:58 2015

  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Last update: Fri May  1 14:46:57 2015

Here r4 advertised the 8.8.8.8/32 to r3 first, r3 then advertised it to r2, r2
selected the path from r3 as the bestpath due to lowest router-id.

r2
BGP routing table entry for 8.8.8.8/32
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.4
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Last update: Fri May  1 15:37:27 2015

  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.3 (10.0.0.3)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Last update: Fri May  1 15:37:27 2015

r3
BGP routing table entry for 8.8.8.8/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.1 10.0.0.2 10.0.0.4 90.1.1.6
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best
      Last update: Fri May  1 15:37:22 2015

The fix is to have bestpath prefer a confed-external path over a confed-internal
path.  I added this just after the "nexthop IGP cost" step because some confed
customers will have one IGP covering multiple sub-ASs, in that case you want to
compare nexthop IGP cost.

9 years agoRemove the '(ignored)' output for nexthops, instead display 'used' for the used one
Donald Sharp [Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)]
Remove the '(ignored)' output for nexthops, instead display 'used' for the used one

9 years agoHere we have an unsual confederations config, "router bgp X" and
Donald Sharp [Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)]
Here we have an unsual confederations config, "router bgp X" and
"bgp confederation id X" are the same value.

router bgp 1
 bgp router-id 10.1.1.1
 bgp confederation identifier 1
 bgp confederation peers 24 35
 neighbor 10.1.1.2 remote-as 24
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.3 remote-as 1
 neighbor 10.1.1.3 update-source lo

The customer does this because they want to peer to 10.1.1.2 as a
confed-external peer but peer with 10.1.1.3 as a normal iBGP peer.

The bug was that we thought 10.1.1.3 was an EBGP peer so we did not send him
LOCALPREF which caused the Juniper to send us a NOTIFICATION. I confirmed
that quagga also sends a NOTIFICATION in this scenario.

The fix is to add a check to see if router bgp X and bgp confederation
identifier X are equal because that is a factor in determining if a peer is
EBGP or IBGP

Additional issues fixed in the this patch:

  We were not properly removing all AS_CONFED_SEQUENCEs/SETs from the aspath
  when advertising a route to an ebgp peer. This was due to two issues:

    We only called aspath_delete_confed_seq() if confederations were
    configured.  We can RX as aspath with CONFED segments even if
    confederations are not configured.

    aspath_delete_confed_seq() was implemented based on the original confed
    RFC 3065 which basically said "remove all of the leading
    AS_CONFED_SEQUENCEs/SETs" where the new confed RFC 5065 says "remove ALL
    of the AS_CONFED_SEQUENCEs/SETs"

  peer-groups did not work for confed-external peers. peer_calc_sort() always
  returned BGP_PEER_EBGP for a confederations where the remote-as was not
  specified. The reason was the peer->as_type was AS_UNSPECIFIED but we checked

    if (peer->as_type != AS_SPECIFIED)
       return (peer->as_type == AS_INTERNAL ? BGP_PEER_IBGP : BGP_PEER_EBGP);

    After fixing that I found that when we got to the else where we checked for
    peer1 we could only possibly return BGP_PEER_IBGP or BGP_PEER_EBGP, we need
    to also be able to return BGP_PEER_CONFED. I changed this to return
    peer1->sort.

  "show ip bgp x.x.x.x" would always display "Local" for the aspath. This is
  because we were calling aspath_counts_hop() to determine if the aspath was
  empty. This is wrong though because CONFED segments do not count towards
  aspath hopcount. The fix is to null check aspath->segments to determine if
  the aspath is actually empty.

  "show ip bgp x.x.x.x" and "show ip bgp neighbor" always displayed
  "internal" or "external" and never "confed-internal" or "confed-external".
  This made troubleshooting difficult because I couldn't tell exactly what
  kind of peer I was dealing with. I added the confed-internal and
  confed-external output...also added a "peer-type" field in the json output
  for 'show ip bgp x.x.x.x'

  "show ip bgp peer-group" did not list the peer-group name if we hadn't
  determined the "type" (internal, external, etc) for the peer-group

9 years agoUse nexthop-global-foo and nexthop-local-foo for all nexthop related JSON keys
Donald Sharp [Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)]
Use nexthop-global-foo and nexthop-local-foo for all nexthop related JSON keys

9 years agoBGP cannot do a "no" on "neighbor x.x.x.x update-source lo"
Donald Sharp [Fri, 12 Jun 2015 14:59:09 +0000 (07:59 -0700)]
BGP cannot do a "no" on "neighbor x.x.x.x update-source lo"

9 years agoWhen an interface goes down, any neigbors learnt on that interface
Donald Sharp [Fri, 12 Jun 2015 14:59:09 +0000 (07:59 -0700)]
When an interface goes down, any neigbors learnt on that interface
using IPv6 Router Advertisements (RAs) must be deleted. When an
interface comes up and neighbors are learnt on that interface, the
BGP FSM for any interface peer must be started only if a valid
local address exists; the local address may come up later after IPv6
Duplicate Address Detection.