]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Fri, 27 Nov 2015 16:47:38 +0000 (08:47 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoQuagga: Nexthop refactoring
Donald Sharp [Fri, 27 Nov 2015 16:46:54 +0000 (08:46 -0800)]
Quagga: Nexthop refactoring

Upstream wanted some nexthop code to be refactored.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoShould be able to "no" the full text of any config line
Daniel Walton [Mon, 23 Nov 2015 18:05:03 +0000 (18:05 +0000)]
Should be able to "no" the full text of any config line

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

8 years agoQuagga: vrf_id not being set correctly
Donald Sharp [Fri, 20 Nov 2015 19:36:46 +0000 (11:36 -0800)]
Quagga: vrf_id not being set correctly

Several routing protocols use the zapi_ipv[4|6] api to talk to
zebra.  There are some instances where the api.vrf_id was not
being set.  Since the practice is to declare the api structure
on the stack, the data inside is not being set to 0.  As
such random vrf_id values were being passed to zebrad
causing rage and confusion.

Ticket: CM-8287
Reviewed-by: CCR-3841
Testing:  Test suites no longer crashing and burning

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
vivek [Fri, 20 Nov 2015 19:10:29 +0000 (11:10 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoZebra: Ignore bridge address family netlink notifications
vivek [Fri, 20 Nov 2015 19:09:25 +0000 (11:09 -0800)]
Zebra: Ignore bridge address family netlink notifications

Ticket: CM-8045
Reviewed By: CCR-3736
Testing Done:

This is an import of patch zebra-ignore-bridge-af.patch from 2.5-br.

8 years agoBGP: Remove the requirement to rebind a peer to its peer-group under the address...
Daniel Walton [Fri, 20 Nov 2015 18:53:50 +0000 (18:53 +0000)]
BGP: Remove the requirement to rebind a peer to its peer-group under the address-family.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-3868

NOTE: Many of the ibgp peers are not up in the 'show ip bgp summ' output below. This
is because ospf was disabled at the time.  The main thing to look for is whether or
not all of the correct peers are listed based on their 'activate' status.

Basic Example
=============

router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP activate
  neighbor IBGP next-hop-self
 exit-address-family
!

superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r2(10.0.0.2)    4    10     107     211        0    0    0 00:23:01 Connect
r3(10.0.0.3)    4    10     107     211        0    0    0 00:23:01 Connect
r4(10.0.0.4)    4    10     207     211        0    0    0 00:23:01 Active
r6(20.1.1.6)    4    20     873     975        0    0    0 00:23:29      600
r7(20.1.1.7)    4    20     873     976        0    0    0 00:23:29      600
r8(40.1.1.2)    4    40     874     975        0    0    0 00:23:30      600
r9(40.1.1.6)    4    40     874     975        0    0    0 00:23:30      600
r10(40.1.1.10)  4    40     874     975        0    0    0 00:23:30      600

Total number of neighbors 8
superm-redxp-05#

Example where one member of the peer-group is inactive...we can do this now that
peer-group members can have different outbound policies from the peer-group.
================================================================================
superm-redxp-05# conf t
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# no neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# do show run
router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP activate
  neighbor IBGP next-hop-self
  no neighbor 10.0.0.3 activate
 exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r2(10.0.0.2)    4    10     107     211        0    0    0 00:23:24 Connect
r4(10.0.0.4)    4    10     207     211        0    0    0 00:23:24 Active
r6(20.1.1.6)    4    20     881     983        0    0    0 00:23:52      600
r7(20.1.1.7)    4    20     881     984        0    0    0 00:23:52      600
r8(40.1.1.2)    4    40     881     982        0    0    0 00:23:53      600
r9(40.1.1.6)    4    40     881     982        0    0    0 00:23:53      600
r10(40.1.1.10)  4    40     881     982        0    0    0 00:23:53      600

Total number of neighbors 7
superm-redxp-05#

Example where the peer-group is inactive but a member of the peer-group is active:
==================================================================================
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# no neighbor IBGP activate
superm-redxp-05(config-router-af)#
superm-redxp-05(config-router-af)# neighbor 10.0.0.4 activate
superm-redxp-05(config-router-af)# end
superm-redxp-05# show run
router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP next-hop-self
  neighbor 10.0.0.4 activate
 exit-address-family
!

superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r4(10.0.0.4)    4    10     207     211        0    0    0 00:24:56 Active
r6(20.1.1.6)    4    20     911    1013        0    0    0 00:25:24      600
r7(20.1.1.7)    4    20     911    1014        0    0    0 00:25:24      600
r8(40.1.1.2)    4    40     912    1013        0    0    0 00:25:25      600
r9(40.1.1.6)    4    40     912    1013        0    0    0 00:25:25      600
r10(40.1.1.10)  4    40     912    1013        0    0    0 00:25:25      600

Total number of neighbors 6
superm-redxp-05#

8 years agoBGP crash in group_announce_route_walkcb
Daniel Walton [Fri, 20 Nov 2015 18:43:33 +0000 (18:43 +0000)]
BGP crash in group_announce_route_walkcb

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

This is a regression from the addpath-tx commit. We loop over the adj_out list
but the adj can be freed within the body of the loop so we need to note adj->next
prior to the free.

8 years agoQuagga default: BGP enable "maximum-paths 64"
Daniel Walton [Fri, 20 Nov 2015 18:41:51 +0000 (18:41 +0000)]
Quagga default: BGP enable "maximum-paths 64"

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

8 years agoZebra: Handle IPv6 address status during initialization
vivek [Fri, 20 Nov 2015 18:34:50 +0000 (10:34 -0800)]
Zebra: Handle IPv6 address status during initialization

At init time, Zebra queries the kernel for all interfaces. At this time,
an IPv6 address may exist on an interface but IPv6 DAD has not completed,
or it could be that DAD has failed. Zebra should examine the flags on
the address and act accordingly. Otherwise, it may end up with addresses
and routes which are not actually valid in the kernel, and this may lead
to, for example, BGP attempting neighbor connections on an interface on
which the source IPv6 address is not yet valid.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
Ticket: CM-7176
Reviewed By: CCR-3815
Testing Done: Verify failed test (needs temporary test change)

Note: Imported from 2.5-br patch zebra-handle-ipv6-addr-status.patch.

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
vivek [Fri, 20 Nov 2015 16:51:48 +0000 (08:51 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoZebra: Cleanup RIB debugs
vivek [Fri, 20 Nov 2015 16:48:32 +0000 (08:48 -0800)]
Zebra: Cleanup RIB debugs

Some of the changes include:
- ensuring IPv6 addresses are printed correctly
- say 'updating' or 'deleting' etc. only when that is actually done
- say 'queuing' or 'dequeuing' only when that is actually done
- print useful info for 'detailed' debug - that now subsumes 'rib queue'
- delete various useless logs
- VRF-specific - print VRF id in RIB debugs prior to prefix
  (e.g., 4:37.1.1.0/28)

Ticket: CM-8110
Reviewed By: CCR-3765
Testing Done: Manual testing (2.5-br)

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Fri, 20 Nov 2015 15:12:30 +0000 (07:12 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoQuagga: Fixup decision about what an unnumbered interface is
Donald Sharp [Fri, 20 Nov 2015 15:10:47 +0000 (07:10 -0800)]
Quagga: Fixup decision about what an unnumbered interface is

This Change modifies what zebra thinks is an unnumbered interface.
If the interface is not a loopback and the prefixlength for the
interface is 32 than consider this an unnumbered interface.

Ticket: CM-8016
Reviewed by: CCR-3827
Testing: Full Regression Suites

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoQuagga: Cleanup RTADV define
Donald Sharp [Fri, 20 Nov 2015 13:33:30 +0000 (08:33 -0500)]
Quagga: Cleanup RTADV define

The RTADV define was not being set correctly or consistently.
Make the code consistent with our HAVE_IPV6 define.

If the user wants to explicitly turn it off then they should
run --disable-rtadv from the configure cli

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agolib: Fixup a compiler warning on netbsd
Donald Sharp [Fri, 20 Nov 2015 14:59:12 +0000 (06:59 -0800)]
lib: Fixup a compiler warning on netbsd

This code has a compiler warning on some oddball platforms

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoZebra: Fix replace route for uninstall scenario
vivek [Thu, 19 Nov 2015 20:48:02 +0000 (12:48 -0800)]
Zebra: Fix replace route for uninstall scenario

When a Quagga route that is currently installed is superceded by a
kernel route (connected or static route to same destination), the
Quagga route is not uninstalled from the kernel. Fix by ensuring
this case is handled correctly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-7152
Reviewed By: CCR-3476
Testing Done: Manual tests and verify failed test.

Fixes: Replace route implementation (IPv4 and IPv6)
8 years agoZebra: Implement route replace for IPv6
vivek [Thu, 19 Nov 2015 20:22:55 +0000 (12:22 -0800)]
Zebra: Implement route replace for IPv6

Zebra currently performs a delete followed by add when a route needs to be
modified. Change this to use the replace semantics of netlink so that the
operation can possibly be atomic.

Note: This patch handles IPv6 routes, IPv4 already performs a replace.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
Ticket: CM-5597
Reviewed By: CCR-3407
Testing Done: Manual testing of various scearnios (Vivek, Satish)

Note: This is an import of patch zebra-ipv6-route-replace.patch from 2.5-br.

8 years agozebra: Fix non usage of VRF_DEFAULT
Donald Sharp [Thu, 19 Nov 2015 12:21:30 +0000 (07:21 -0500)]
zebra: Fix non usage of VRF_DEFAULT

A vrf_id was being set to 0 instead of VRF_DEFAULT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoQuagga: Fixup cli and json keyword
Donald Sharp [Wed, 18 Nov 2015 23:36:04 +0000 (15:36 -0800)]
Quagga: Fixup cli and json keyword

The json keyword was being read incorrectly.
Basically some commands read a variable # of arguments
and in ospf the command values were being placed into
argc and argv.  With a variable # of arguments their
existed a possibility that less arguments would be read
from the cli than were being tested for in the command function
handler.  This caused core dumps in some situations.

All code to read to decide to use the json keyword has
been centralized through a function and all code
converted to use it, irrelevant if it exhibited the bug

Ticket: CM-8278
Reviewed by: CCR-3830
Testing: OSPF no longer crashes and all other test suites still run

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP: extcommunity-list are displayed before community-list
Daniel Walton [Wed, 18 Nov 2015 18:54:23 +0000 (18:54 +0000)]
BGP: extcommunity-list are displayed before community-list

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

"ip extcommunity-list" is displayed as part of COMMUNITY_LIST_NODE
but vtysh_config_parse_line() was not checking for "ip extcommunity-list"

8 years agoBGP: Handle router-id correctly in config and display.
vivek [Tue, 17 Nov 2015 21:57:56 +0000 (13:57 -0800)]
BGP: Handle router-id correctly in config and display.

BGP is currently displaying the in-use router-id in the config. This is
conditional on a CONFIG flag, however, that flag is set even when there
is no configured router-id and the router-id learnt from Zebra is in-use.
The CONFIG flag for router-id is redundant since there is a separate
variable for the configured value, so use that and deprecate the CONFIG
flag. This also makes BGP behave like OSPF.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-8077, CM-8220
Reviewed By: CCR-3793
Testing Done: Manual verification (in 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-router-id-config-display.patch

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Tue, 17 Nov 2015 21:33:17 +0000 (13:33 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoBGP: Update dump to allow Extended Time Format
Alexis Fasquel [Mon, 16 Nov 2015 18:55:16 +0000 (13:55 -0500)]
BGP: Update dump to allow Extended Time Format

Allow the bgp dump functionality to handle the Extended Time format
as specified in RFC 6396.

Fixes a segmentation fault with multiple dump rules as well.

Signed-off-by: Alexis Fasquel <alexis@pch.net>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoQuagga: Set MULTIPATH_NUM to 64 when user specifies 0 from cli
Donald Sharp [Tue, 17 Nov 2015 16:13:23 +0000 (08:13 -0800)]
Quagga: Set MULTIPATH_NUM to 64 when user specifies 0 from cli

The code has tests to see if the MULTIPATH_NUM == 0 and to
treat it like the user has entered 'Maximum PATHS'.
This 0 is treated as 64 internally.  Remove this dependency
and setup MULTIPATH_NUM to 64 when --enable-multipath=0 from
the configure cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
8 years agoBGP: crash in update_subgroup_merge()
Daniel Walton [Tue, 17 Nov 2015 02:09:57 +0000 (02:09 +0000)]
BGP: crash in update_subgroup_merge()

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-8191

On my hard node I have a route to 10.0.0.0/22 via eth0, I then learn
10.0.0.8/32 from peer 10.0.0.8 with a nexthop of 10.0.0.8:

superm-redxp-05# show ip bgp 10.0.0.8/32
BGP routing table entry for 10.0.0.8/32
Paths: (1 available, no best path)
  Not advertised to any peer
  80
    10.0.0.8 from r8(swp6) (10.0.0.8)
      Origin IGP, metric 0, localpref 100, valid, external
      AddPath ID: RX 0, TX 9
      Last update: Thu Nov 12 14:00:00 2015

superm-redxp-05#

I do a lookup for the nexthop and see that 10.0.0.8 is reachable via my
eth0 10.0.0.22 so I select a bestpath and install the route.  At this
point my route to 10.0.0.8 is a /32 that resolves via itself, NHT sees
that this is illegal and flags the nexthop as inaccessible.

superm-redxp-05# show ip bgp 10.0.0.8/32
BGP routing table entry for 10.0.0.8/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  r6(swp4) r7(swp5) r8(swp6) r2(10.1.2.2) r3(10.1.3.2) r4(10.1.4.2)
  80
    10.0.0.8 (inaccessible) from r8(swp6) (10.0.0.8)
      Origin IGP, metric 0, localpref 100, invalid, external, bestpath-from-AS 80, best
      AddPath ID: RX 0, TX 9
      Last update: Thu Nov 12 14:00:00 2015

superm-redxp-05#

at which point we withdraw the route, things churn, we relearn it and go
through the whole process over and over again.  We end up advertising and
withdrawing this route about 9 times a second!!

This exposed a crash in the update-group code where we try to merge two sub-groups
but the assert on adj_count fails because the timing worked out where one had
advertised 10.0.0.8/32 but the other had not.

NOTE: the race condition described above will be resolved via a separate patch.

8 years agoZebra: Remove reliance on NEXTHOP_TYPE_IPV4_ONLINK
Donald Sharp [Mon, 16 Nov 2015 20:48:07 +0000 (12:48 -0800)]
Zebra: Remove reliance on NEXTHOP_TYPE_IPV4_ONLINK

Zebra already knows if an interface is unnumbered or not.  This
is communicated to OSPF.
OSPF would only send a NEXTHOP_TYPE_IPV4_ONLINK *if* the path
was unnumbered, which it learns from Zebra.

As such, Have OSPF use the normal NEXTHOP_TYPE_IPV4_IFINDEX
type for unnumbered paths.  In Zebra, if the ifindex recieved
is unnumbered then assume that the link is NEXTHOP_FLAG_ONLINK.

Ticket: CM-8145
Reviewed-by: CCR-3771
Testing: See bug

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP: Fix nexthop registration churn
vivek [Sun, 15 Nov 2015 18:21:12 +0000 (10:21 -0800)]
BGP: Fix nexthop registration churn

When a BGP nexthop is registered for resolution, if it is learnt from an
EBGP peer and other conditions warrant (non-multihop peer and connected check
is not disabled), the registration includes a flag that indicates that the
nexthop must be resolved only if it is directly connected. In peculiar
situations - e.g., third-party nexthop or policy configuration - the same
nexthop could be learnt from an IBGP peer, and in general, nexthops learnt
from IBGP peers can be resolved over any route. This scenario was causing
a churn in the nexthop registration with the 'must-be-connected' flag being
repeatedly toggled as routes are received from both peers. The registrations
would in turn trigger significant processing.

The fix is to treat 'must-be-connected' as an overriding condition.

The repeated registration and related processing was also causing heavy memory
usage by BGP - for memory buffers used to hold registration information. This
fix will ensure that is no longer the case.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-8005, CM-8013
Reviewed By: CCR-3772
Testing Done: Manual, bgpsmoke (on 2.5-br)

8 years agoBGP: Handle change to nexthop correctly
vivek [Sun, 15 Nov 2015 17:57:34 +0000 (09:57 -0800)]
BGP: Handle change to nexthop correctly

When a nexthop change is received and processed, the change flags are not
examined correctly and route change flags not updated correctly. Fix to
ensure correct handling.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-8141
Reviewed By: CCR-3773
Testing Done: Manual verification

Note: Imported from 2.5-br patch bgpd-nht-fix-change-handling.patch

8 years agoZebra: Ensure correct route is used for redistribute delete.
vivek [Sun, 15 Nov 2015 15:36:50 +0000 (07:36 -0800)]
Zebra: Ensure correct route is used for redistribute delete.

After the optimization introduced by patch zebra-redist-update-fix.patch
which implements "replace" semantics for redistributed routes instead of
a delete followed by add, the code was passing an incorrect route for
redistribute deletion in one case. This is mainly inconsequential as of
now as the deletion process primarily cares about only the destination, but
the code needs to be corrected and that is done here.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Fixes: zebra-redist-update-fix.patch
Ticket: CM-8112
Reviewed By: CCR-3760
Testing Done: Trivial

Note:
1. Needs changes after IPv6 route replace patches are included.
2. Imported from 2.5-br patch zebra-redist-delete-fix.patch

8 years agoBGP: Fix the setting of link-local nexthops in some situations
vivek [Sun, 15 Nov 2015 15:17:47 +0000 (07:17 -0800)]
BGP: Fix the setting of link-local nexthops in some situations

This patch addresses three main issues:
a. Passing along the global IPv6 nexthop received from the EBGP peer to
IBGP peers but setting the link-local IPv6 nexthop to ourselves when
advertising EBGP-learnt routes to IBGP peers (in the absence of outbound
route-map or other overrides). The fix is to not send a link-local IPv6
nexthop in this case.

b. Passing along the link-local IPv6 nexthop received from one peer to
another peer which is (or may be) on a different subnet. This violates the
semantics of link-local IPv6 address. The fix is to set the nexthop to
ourselves in the situation where the nexthop normally has to be passed
but is a link-local IPv6 address.

c. Different behavior wrt nexthop advertisement for BGP unnumbered peering
if it is setup using link-local IPv6 address versus IPv4 /30 or /31. The
fix is to make the behavior consistent as long as the interface config is
the same in both cases.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-7846, CM-8043
Reviewed By: CCR-3749
Testing Done: Manual testing, bgpsmoke (on 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-link-local-nexthop-setting.patch

8 years agoQuagga default: BGP enable "maximum-paths 64"
Daniel Walton [Fri, 13 Nov 2015 21:52:13 +0000 (21:52 +0000)]
Quagga default: BGP enable "maximum-paths 64"

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

8 years agoBGP: Remove deprecated commands and add warning that "show ipv6 bgp"
Daniel Walton [Fri, 13 Nov 2015 03:14:10 +0000 (03:14 +0000)]
BGP: Remove deprecated commands and add warning that "show ipv6 bgp"
will be deprecated in the future

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-8144

8 years agoOSPF: remove deprecated commands
Daniel Walton [Fri, 13 Nov 2015 02:38:42 +0000 (02:38 +0000)]
OSPF: remove deprecated commands

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

8 years agobgp may add multiple path entries with the same nexthop
Daniel Walton [Thu, 12 Nov 2015 20:30:22 +0000 (20:30 +0000)]
bgp may add multiple path entries with the same nexthop

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

- We have 14 paths for each prefix, 7 are from ipv4 peers and 7 are from ipv6 peers

- There are 7 unique nexthops

- When comparing the exact same path from an v4 peer vs. a v6 peer the path from
  the v4 peer wins.  This is due to the "lowest neighbor IP" check in the decision
  algorithm.  For example below we learn NEXTHOP 210.2.4.2 from 210.2.4.2 and
  2001:20:4::2 but only the one from the v4 peer is flagged as multipath.

- The problem is when our bestpath is from a v6 peer, 2001:20:2::2 in this case
  (see line 85). 2001:20:2::2 sent us 210.2.2.2 so we will install that nexthop
  because it is from our bestpath, the problem is we flag the path from 210.2.2.2
  (line 37) as multipath which causes us to install two paths with nexthop 210.2.2.2

  1 superm-redxp-05# show ip bgp 2.23.24.192/28
  2 BGP routing table entry for 2.23.24.192/28
  3 Paths: (14 available, best #14, table Default-IP-Routing-Table)
  4   Advertised to non peer-group peers:
  5   210.2.0.2 210.2.1.2 210.2.2.2 210.2.3.2 210.2.4.2 210.2.5.2 210.2.6.2 210.4.1.4 2001:20::2 2001:20:1::2 2001:20:2::2 2001:20:3::2 2001:20:4::2 2001:2
  6   205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
  7     210.2.4.2 from 210.2.4.2 (10.0.0.2)
  8       Origin IGP, localpref 100, valid, external, multipath
  9       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 10       Last update: Wed Nov 11 20:54:57 2015
 11
 12   204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 13     210.2.3.2 from 210.2.3.2 (10.0.0.2)
 14       Origin IGP, localpref 100, valid, external, multipath
 15       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 16       Last update: Wed Nov 11 20:54:57 2015
 17
 18   202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 19     210.2.1.2 from 210.2.1.2 (10.0.0.2)
 20       Origin IGP, localpref 100, valid, external, multipath
 21       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 22       Last update: Wed Nov 11 20:54:57 2015
 23
 24   206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 25     210.2.5.2 from 2001:20:5::2 (10.0.0.2)
 26       Origin IGP, localpref 100, valid, external
 27       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 28       Last update: Wed Nov 11 20:54:57 2015
 29
 30   205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 31     210.2.4.2 from 2001:20:4::2 (10.0.0.2)
 32       Origin IGP, localpref 100, valid, external
 33       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 34       Last update: Wed Nov 11 20:54:57 2015
 35
 36   203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 37     210.2.2.2 from 210.2.2.2 (10.0.0.2)
 38       Origin IGP, localpref 100, valid, external, multipath
 39       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 40       Last update: Wed Nov 11 20:54:57 2015
 41
 42   202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 43     210.2.1.2 from 2001:20:1::2 (10.0.0.2)
 44       Origin IGP, localpref 100, valid, external
 45       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 46       Last update: Wed Nov 11 20:54:57 2015
 47
 48   201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 49     210.2.0.2 from 210.2.0.2 (10.0.0.2)
 50       Origin IGP, localpref 100, valid, external, multipath
 51       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 52       Last update: Wed Nov 11 20:54:57 2015
 53
 54   206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 55     210.2.5.2 from 210.2.5.2 (10.0.0.2)
 56       Origin IGP, localpref 100, valid, external, multipath
 57       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 58       Last update: Wed Nov 11 20:54:57 2015
 59
 60   207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 61     210.2.6.2 from 2001:20:6::2 (10.0.0.2)
 62       Origin IGP, localpref 100, valid, external
 63       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 64       Last update: Wed Nov 11 20:54:57 2015
 65
 66   207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 67     210.2.6.2 from 210.2.6.2 (10.0.0.2)
 68       Origin IGP, localpref 100, valid, external, multipath
 69       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 70       Last update: Wed Nov 11 20:54:57 2015
 71
 72   201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 73     210.2.0.2 from 2001:20::2 (10.0.0.2)
 74       Origin IGP, localpref 100, valid, external
 75       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 76       Last update: Wed Nov 11 20:54:57 2015
 77
 78   204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 79     210.2.3.2 from 2001:20:3::2 (10.0.0.2)
 80       Origin IGP, localpref 100, valid, external
 81       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 82       Last update: Wed Nov 11 20:54:57 2015
 83
 84   203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 85     210.2.2.2 from 2001:20:2::2 (10.0.0.2)
 86       Origin IGP, localpref 100, valid, external, multipath, best
 87       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 88       Last update: Wed Nov 11 20:54:57 2015
 89
 90 superm-redxp-05#

Here you can see the two paths with nexthop 210.2.2.2

superm-redxp-05# show ip route 2.23.24.192/28
Routing entry for 2.23.24.192/28
  Known via "bgp", distance 20, metric 0, best
  Last update 00:32:12 ago
  * 210.2.2.2, via swp3
  * 210.2.0.2, via swp1
  * 210.2.1.2, via swp2
  * 210.2.2.2, via swp3
  * 210.2.3.2, via swp4
  * 210.2.4.2, via swp5
  * 210.2.5.2, via swp6
  * 210.2.6.2, via swp7

superm-redxp-05#
superm-redxp-05#

The fix is to not flag a path as multipath if it has the same nexthop as the bestpath

8 years agoBGP: "redistribute" is missing from the "address-family ipv4 unicast" sub-context
Daniel Walton [Thu, 12 Nov 2015 20:25:46 +0000 (20:25 +0000)]
BGP: "redistribute" is missing from the "address-family ipv4 unicast" sub-context

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

8 years agoBGP: changing remote-as from external to external resets connection
Donald Sharp [Wed, 11 Nov 2015 16:52:51 +0000 (08:52 -0800)]
BGP: changing remote-as from external to external resets connection

Modify code to recognize that we are not actually reseting the
neighbor if the user actually enters a remote-as of external->external
for a neighbor.

Ticket: CM-8100
Reviewed-by: CCR-3783
Testing: See bug

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoQuagga default: BGP "no-as-set" should be the default for "bgp as-path multipath...
Daniel Walton [Tue, 10 Nov 2015 15:33:24 +0000 (15:33 +0000)]
Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath-relax"

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

8 years agoBGP: route-server will now use addpath...chop the _rsclient code
Daniel Walton [Tue, 10 Nov 2015 15:29:12 +0000 (15:29 +0000)]
BGP: route-server will now use addpath...chop the _rsclient code

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

per draft-ietf-idr-ix-bgp-route-server-09:

2.3.2.2.2.  BGP ADD-PATH Approach

   The [I-D.ietf-idr-add-paths] Internet draft proposes a different
   approach to multiple path propagation, by allowing a BGP speaker to
   forward multiple paths for the same prefix on a single BGP session.

   As [RFC4271] specifies that a BGP listener must implement an implicit
   withdraw when it receives an UPDATE message for a prefix which
   already exists in its Adj-RIB-In, this approach requires explicit
   support for the feature both on the route server and on its clients.

   If the ADD-PATH capability is negotiated bidirectionally between the
   route server and a route server client, and the route server client
   propagates multiple paths for the same prefix to the route server,
   then this could potentially cause the propagation of inactive,
   invalid or suboptimal paths to the route server, thereby causing loss
   of reachability to other route server clients.  For this reason, ADD-
   PATH implementations on a route server should enforce send-only mode
   with the route server clients, which would result in negotiating
   receive-only mode from the client to the route server.

This allows us to delete all of the following code:

- All XXXX_rsclient() functions
- peer->rib
- BGP_TABLE_MAIN and BGP_TABLE_RSCLIENT
- RMAP_IMPORT and RMAP_EXPORT

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Tue, 10 Nov 2015 01:04:20 +0000 (17:04 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoZebra: Remove dependency on rib_bogus_ipv6
Donald Sharp [Tue, 10 Nov 2015 01:02:26 +0000 (17:02 -0800)]
Zebra: Remove dependency on rib_bogus_ipv6

rib_bogus_ipv6 was removed upstream.  We need to do the same thing
and ensure that our ipv6 multipath still works

Ticket: CM-8152
Reviewed by: CCR-3775
Testing: Ran all multipath tests

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoOSPF: Fix zlog_warn to zlog_debug in some unlikely scenarios
Donald Sharp [Mon, 9 Nov 2015 14:51:45 +0000 (06:51 -0800)]
OSPF: Fix zlog_warn to zlog_debug in some unlikely scenarios

When there is an OSPF missconfiguration, do not zlog_warn the fact
as that it would quickly overwhelm any log file.

Ticket: CM-7534
Reviewed by: CCR-3756
Testing: See bug

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoQuagga crash in prefix_list_apply
Daniel Walton [Fri, 6 Nov 2015 16:36:37 +0000 (16:36 +0000)]
Quagga crash in prefix_list_apply

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

8 years agoBGP: Implement "neighbor x.x.x.x addpath-tx-bestpath-per-AS"
Daniel Walton [Fri, 6 Nov 2015 16:34:41 +0000 (16:34 +0000)]
BGP: Implement "neighbor x.x.x.x addpath-tx-bestpath-per-AS"

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

8 years agoBGP: Correctly display local-as for peer-group member
Daniel Walton [Thu, 5 Nov 2015 22:42:38 +0000 (22:42 +0000)]
BGP: Correctly display local-as for peer-group member

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

8 years agoBGP: support for addpath TX
Daniel Walton [Thu, 5 Nov 2015 17:29:43 +0000 (17:29 +0000)]
BGP: support for addpath TX

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com
Ticket: CM-8014

This implements addpath TX with the first feature to use it
being "neighbor x.x.x.x addpath-tx-all-paths".

One change to show output is 'show ip bgp x.x.x.x'.  If no addpath-tx
features are configured for any peers then everything looks the same
as it is today in that "Advertised to" is at the top and refers to
which peers the bestpath was advertise to.

root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1'
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 8
      Last update: Fri Oct 30 18:26:44 2015
[snip]

but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis:

superm-redxp-05# show ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 8
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:44 2015

  Local, (Received from a RR-client)
    34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 7
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 6
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 5
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 4
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      AddPath ID: RX 0, TX 3
      Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:34 2015

superm-redxp-05#

8 years agodebian: Modify Quagga cumulus version in debian packaging
Donald Sharp [Wed, 4 Nov 2015 23:44:29 +0000 (15:44 -0800)]
debian: Modify Quagga cumulus version in debian packaging

Modify the debian packaging to 3.0 for cmaster branch

Ticket: CM-8106
Reviewed by: CCR-3755

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP ORF fails to filter prefixes correctly
Daniel Walton [Wed, 4 Nov 2015 16:31:33 +0000 (16:31 +0000)]
BGP ORF fails to filter prefixes correctly

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

8 years agoBGP: enable deterministic-med by default
Daniel Walton [Wed, 4 Nov 2015 16:05:56 +0000 (16:05 +0000)]
BGP: enable deterministic-med by default

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

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Vipin Kumar [Wed, 4 Nov 2015 06:05:02 +0000 (22:05 -0800)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years ago*: add VRF ID in the API message header
Feng Lu [Thu, 16 Oct 2014 01:52:36 +0000 (09:52 +0800)]
*: add VRF ID in the API message header

The API messages are used by zebra to exchange the interfaces, addresses,
routes and router-id information with its clients. To distinguish which
VRF the information belongs to, a new field "VRF ID" is added in the
message header. And hence the message version is increased to 3.

* The new field "VRF ID" in the message header:

    Length    (2 bytes)
    Marker    (1 byte)
    Version   (1 byte)
    VRF ID    (2 bytes, newly added)
    Command   (2 bytes)

  - Client side:

    - zclient_create_header() adds the VRF ID in the message header.
    - zclient_read() extracts and validates the VRF ID from the header,
      and passes the VRF ID to the callback functions registered to
      the API messages.
    - All relative functions are appended with a new parameter "vrf_id",
      including all the callback functions.
    - "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6".
      Clients need to correctly set the VRF ID when using the API
      functions zapi_ipv4_route() and zapi_ipv6_route().
    - Till now all messages sent from a client have the default VRF ID
      "0" in the header.
    - The HELLO message is special, which is used as the heart-beat of
      a client, and has no relation with VRF. The VRF ID in the HELLO
      message header will always be 0 and ignored by zebra.

  - Zebra side:

    - zserv_create_header() adds the VRF ID in the message header.
    - zebra_client_read() extracts and validates the VRF ID from the
      header, and passes the VRF ID to the functions which process
      the received messages.
    - All relative functions are appended with a new parameter "vrf_id".

* Suppress the messages in a VRF which a client does not care:

  Some clients may not care about the information in the VRF X, and
  zebra should not send the messages in the VRF X to those clients.

  Extra flags are used to indicate which VRF is registered by a client,
  and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client
  can unregister a VRF when it does not need any information in that
  VRF.

  A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF
  will automatically register to that VRF.

  - lib/vrf:

    A new utility "VRF bit-map" is provided to manage the flags for
    VRFs, one bit per VRF ID.

    - Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a
      bit-map;
    - Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag
      in the given bit-map, corresponding to the given VRF ID;
    - Use vrf_bitmap_check() to test whether the flag, in the given
      bit-map and for the given VRF ID, is set.

  - Client side:

    - In "struct zclient", the following flags are changed from
      "u_char" to "vrf_bitmap_t":
          redist[ZEBRA_ROUTE_MAX]
          default_information
      These flags are extended for each VRF, and controlled by the
      clients themselves (or with the help of zclient_redistribute()
      and zclient_redistribute_default()).

  - Zebra side:

    - In "struct zserv", the following flags are changed from
      "u_char" to "vrf_bitmap_t":
          redist[ZEBRA_ROUTE_MAX]
          redist_default
          ifinfo
          ridinfo

      These flags are extended for each VRF, as the VRF registration
      flags. They are maintained on receiving a ZEBRA_XXX_ADD or
      ZEBRA_XXX_DELETE message.

      When sending an interface/address/route/router-id message in
      a VRF to a client, if the corresponding VRF registration flag
      is not set, this message will not be dropped by zebra.

    - A new function zread_vrf_unregister() is introduced to process
      the new command ZEBRA_VRF_UNREGISTER. All the VRF registration
      flags are cleared for the requested VRF.

  Those clients, who support only the default VRF, will never receive
  a message in a non-default VRF, thanks to the filter in zebra.

* New callback for the event of successful connection to zebra:

  - zclient_start() is splitted, keeping only the code of connecting
    to zebra.

  - Now zclient_init()=>zclient_connect()=>zclient_start() operations
    are purely dealing with the connection to zbera.

  - Once zebra is successfully connected, at the end of zclient_start(),
    a new callback is used to inform the client about connection.

  - Till now, in the callback of connect-to-zebra event, all clients
    send messages to zebra to request the router-id/interface/routes
    information in the default VRF.

    Of corse in future the client can do anything it wants in this
    callback. For example, it may send requests for both default VRF
    and some non-default VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Conflicts:
lib/zclient.h
lib/zebra.h
zebra/zserv.c
zebra/zserv.h

Conflicts:
bgpd/bgp_nexthop.c
bgpd/bgp_nht.c
bgpd/bgp_zebra.c
isisd/isis_zebra.c
lib/zclient.c
lib/zclient.h
lib/zebra.h
nhrpd/nhrp_interface.c
nhrpd/nhrp_route.c
nhrpd/nhrpd.h
ospf6d/ospf6_zebra.c
ospf6d/ospf6_zebra.h
ospfd/ospf_vty.c
ospfd/ospf_zebra.c
pimd/pim_zebra.c
pimd/pim_zlookup.c
ripd/rip_zebra.c
ripngd/ripng_zebra.c
zebra/redistribute.c
zebra/rt_netlink.c
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zserv.c
zebra/zserv.h

8 years agoBGP: vtysh should accept just "router bgp" if the AS is already defined
Daniel Walton [Tue, 3 Nov 2015 18:59:57 +0000 (10:59 -0800)]
BGP: vtysh should accept just "router bgp" if the AS is already defined

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

8 years agoEnable OSPF "log-adjacency-changes" by default
Daniel Walton [Tue, 3 Nov 2015 18:48:30 +0000 (10:48 -0800)]
Enable OSPF "log-adjacency-changes" by default

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

8 years agoAdd "no debug ospf" and "no debug ospf6" commands to disable all ospf debugging
Daniel Walton [Tue, 3 Nov 2015 18:37:25 +0000 (10:37 -0800)]
Add "no debug ospf" and "no debug ospf6" commands to disable all ospf debugging

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

8 years agolib: Fix missing plist_int.h
Donald Sharp [Tue, 3 Nov 2015 18:00:30 +0000 (10:00 -0800)]
lib: Fix missing plist_int.h

Signed-off-by: Donald Sharpd <sharpd@cumulusnetworks.com>
8 years agolib: optimise prefix list setup
David Lamparter [Mon, 13 Apr 2015 08:21:37 +0000 (10:21 +0200)]
lib: optimise prefix list setup

- duplicate prefix check can use the trie structure
- appending with a seq# beyond the end of the list can shortcut

Configuration load is now bottlenecked by cmd_element_match() and
strcmp().  For a real-world routeserver prefix list configuration
(38668 lines of config for multiple prefix lists):
  before: 4.73s
  after:  1.92s    x 2.46

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: use trie structure for prefix list matching
David Lamparter [Mon, 13 Apr 2015 08:21:36 +0000 (10:21 +0200)]
lib: use trie structure for prefix list matching

Prefix lists were implemented with a simple linear list that is scanned
sequentially.  This is, of course, extremely inefficient as it scales by
O(n).  This patch adds a trie-ish data structure that allows quickly
descending based on the prefix.

Note that the trie structure used here is designed for real-world use,
hence it uses a relatively crude fixed-size bytewise table instead of
some fancy balancing scheme.  It is quite cacheline efficient.

Using real-world routeserver prefix lists, matching against a fulltable
dump:

entries   before     after    factor
   9103   63.8s      .0124s   5142x
    772    4.52s     .0101s    445.3x
     86     .445s    .0098s     45.51x
      7     .0379s   .0099s      3.834x
      2     .0136s   .0095s      1.440x
      1     .0084s   .0095s       .879x

This buys CPU with memory.  Memory usage on an IXP setup with 100k
prefix list entries is an additional 4 MB on top of the 9.5 MB that it
was before.

8 years agolib: straighten out ORF prefix list support
David Lamparter [Mon, 13 Apr 2015 08:21:35 +0000 (10:21 +0200)]
lib: straighten out ORF prefix list support

BGP ORF prefix lists are in a separate namespace; this was previously
hooked up with a special-purpose AFI value.  This is a little kludgy for
extension, hence this splits it off.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib: hide internal prefix list structures
David Lamparter [Mon, 13 Apr 2015 08:21:34 +0000 (10:21 +0200)]
lib: hide internal prefix list structures

These are about to be touched and there's no point in other code
touching into prefix list's internas.  Add some isolation.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agoFixing a space before VRF_CMD_STR in ip route commands.
Vipin Kumar [Fri, 30 Oct 2015 18:41:10 +0000 (11:41 -0700)]
Fixing a space before VRF_CMD_STR in ip route commands.

Ticket:
Reviewed By:
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Fri, 30 Oct 2015 12:52:29 +0000 (05:52 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

Conflicts:
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_vty.c

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Vipin Kumar [Fri, 30 Oct 2015 10:06:25 +0000 (03:06 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoFixing a few compile errors
Vipin Kumar [Fri, 30 Oct 2015 10:05:03 +0000 (03:05 -0700)]
Fixing a few compile errors

Ticket:
Reviewed By:
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>

8 years agozebra_vrf lookup fix in upstream VRF patches
Vipin Kumar [Fri, 30 Oct 2015 09:12:14 +0000 (02:12 -0700)]
zebra_vrf lookup fix in upstream VRF patches

Ticket:
Reviewed By:
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>

8 years agozebra, lib/memtypes.c: the netlink sockets work per VRF
Feng Lu [Thu, 3 Jul 2014 10:23:09 +0000 (18:23 +0800)]
zebra, lib/memtypes.c: the netlink sockets work per VRF

This patch lets the netlink sockets work per VRF.

* The definition of "struct nlsock" is moved into zebra/rib.h.

* The previous global variables "netlink" and "netlink_cmd" now
  become the members of "struct zebra_vrf", and are initialized
  in zebra_vrf_alloc().

* All relative functions now work for a specific VRF, by adding
  a new parameter which specifies the working VRF, except those
  functions in which the VRF ID can be obtained from the interface.

* kernel_init(), interface_list() and route_read() are now also
  working per VRF, and moved from main() to zebra_vrf_enable().

* A new function kernel_terminate() is added to release the
  netlink sockets. It is called from zebra_vrf_disable().

* Correct VRF ID, instead of the previous VRF_DEFAULT, are now
  passed to the functions of processing interfaces or route
  entries.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Conflicts:
lib/memtypes.c
zebra/rib.h
zebra/rt_netlink.c

Conflicts:
zebra/if_netlink.c
zebra/if_sysctl.c
zebra/kernel_null.c
zebra/rib.h
zebra/rt_netlink.c
zebra/rt_netlink.h

8 years agozebra: maintain RTADV per VRF
Feng Lu [Fri, 22 May 2015 09:40:10 +0000 (11:40 +0200)]
zebra: maintain RTADV per VRF

This moves the global variable "rtadv" into the "struct zebra_vrf",
so that RTADV feature can work per VRF.

* rtadv.c/rtadv.h:

  Add a proper parameter to the functions so that the entity of the
  "struct zebra_vrf" and interfaces can be obtained from the specified
  VRF.

  The old rtadv_init() is splitted into:
  - rtadv_cmd_init(): it installs the RTADV commands; is called from
                      main();
  - new rtadv_init(): it creates the socket; is called from
                      zebra_vrf_enable().

  rtadv_terminate() is added to stop the threads, close the socket and
  clear the counters. It is called from zebra_vrf_disable().

  rtadv_make_socket() now calls vrf_socket() to create a socket in
  the VRF.

* interface.h and rib.h: define the macro RTADV.
* main.c: according changes, refer to rtadv.c.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/interface.h
zebra/rib.h
zebra/rtadv.c
zebra/rtadv.h

8 years agozebra: add hooks upon enabling / disabling a VRF
Feng Lu [Fri, 22 May 2015 09:40:09 +0000 (11:40 +0200)]
zebra: add hooks upon enabling / disabling a VRF

zebra_vrf_enable() is the callback for VRF_ENABLE_HOOK.
It presently needs do nothing.

zebra_vrf_disable() is the callback for VRF_DISABLE_HOOK.
It presently withdraws routes, shuts down interfaces, and
clears the router-id candidates in that VRF.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib/vrf: enable / disable a VRF
Feng Lu [Fri, 22 May 2015 09:40:08 +0000 (11:40 +0200)]
lib/vrf: enable / disable a VRF

A new API vrf_is_enabled() is defined to check whether a VRF is ready
to use, that is, to allocate resources in that VRF. Currently there's
only one type of resource: socket.

Two new hooks VRF_ENABLE_HOOK/VRF_DISABLE_HOOK are introduced to tell
the user when a VRF gets ready or to be unavailable.

The VRF_ENABLE_HOOK callback is called in the new function vrf_enable(),
which is used to let the VRF be ready to use. Till now, only the default
VRF can be enabled, and we need do nothing to enable the default, except
calling the hook.

The VRF_DISABLE_HOOK callback is called in the new function
vrf_disable(), which is used to let the VRF be unusable. Till now,
it is called only when the VRF is to be deleted.

A new utility vrf_socket() is defined to provide a socket in a given
VRF to the user.

Till now before introducing a way of VRF realization, only the default
VRF is enabled since its birth, and vrf_socket() creates socket for
only the default VRF.

This patch defines the framework of the VRF APIs. The way they serve
the users is:
- vrf_is_enabled() is used to tell the user whether a VRF is usable;
- users are informed by the VRF_ENABLE_HOOK that a VRF gets usable;
  they can allocate resources after that;
- users are informed by the VRF_DISABLE_HOOK that a VRF is to be
  unavailable, and they must release the resources instantly;
- vrf_socket() is used to provide a socket in a given VRF.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agozebra: maintain the router-id per VRF
Feng Lu [Fri, 22 May 2015 09:40:07 +0000 (11:40 +0200)]
zebra: maintain the router-id per VRF

A router may need different identifier among the VRFs. So move the
maintenance of router-id per VRF.

* rib.h:

  Move the previous global variables in router-id.c into the
  "struct zebra_vrf":
  - struct list _rid_all_sorted_list/*rid_all_sorted_list
  - struct list _rid_lo_sorted_list/*rid_lo_sorted_list
  - struct prefix rid_user_assigned

* router-id.c/router-id.h:

  A new parameter "vrf_id" is added to all the router-id APIs.
  Their operations are done only within the specified VRF.

  A new command "router-id A.B.C.D vrf N" is added to allow
  manual router-id for any VRF.

  The old router_id_init() function is splitted into two:
  - router_id_cmd_init(): it only installs the commands
  - router_id_init(): this new one initializes the variables for
                      a specified VRF

* zebra_rib.c: Add new functions zebra_vrf_get/lookup() called
               from router-id.c.

* main.c: Replace router_id_init() with router_id_cmd_init() and
          call the new router_id_init() in zebra_vrf_new().

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/rib.h

Conflicts:
zebra/rib.h
zebra/router-id.c
zebra/zserv.h

8 years agozebra: configure static routes in any VRF
Feng Lu [Fri, 22 May 2015 09:40:06 +0000 (11:40 +0200)]
zebra: configure static routes in any VRF

Introduce new commands to configure static routes in any VRF, by
appending the old static route commands with a new parameter
"vrf N".

A new parameter "const char *vrf_id_str" is added to the functions
zebra_static_ipv4() and static_ipv6_func() to get the configured
VRF ID.

A new member "vrf_id" is added to the "struct static_ipv4" and
"struct static_ipv6", indicating which VRF this static route is
configured in.

But till now, no interface can exist in any non-default VRF. So
these static routes in non-default VRFs are kept inactive.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/zebra_rib.c
zebra/zebra_vty.c

8 years agozebra: lookup the address in all VRFs when set the route-map rule "set src"
Feng Lu [Fri, 22 May 2015 09:40:05 +0000 (11:40 +0200)]
zebra: lookup the address in all VRFs when set the route-map rule "set src"

When configuring the route-map rule "set src A.B.C.D", it checked
whether the source address exists on some interface.

Now it checks the source address throughout all VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/zebra_routemap.c

Conflicts:
zebra/zebra_routemap.c

8 years agozebra: let the route-map rule "match interface" work for VRFs
Feng Lu [Fri, 22 May 2015 09:40:04 +0000 (11:40 +0200)]
zebra: let the route-map rule "match interface" work for VRFs

Introduce a new "struct nexthop_vrfid" to specify a nexthop together
with the VRF ID it belongs to.

Thus in route_match_interface(), we can lookup the interface from
the correct VRF.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/zebra_rib.c
zebra/zebra_routemap.c

8 years agozebra: show routes in a specified VRF or all VRFs
Feng Lu [Fri, 22 May 2015 09:40:03 +0000 (11:40 +0200)]
zebra: show routes in a specified VRF or all VRFs

The present "show ip[v6] [m]route [xxx]" and "show ip rpf [xxx]"
commands now show routes only in the default VRF.

A new option is introduced to show routes in a specified VRF:
    show ip[v6] [m]route [xxx] vrf N
    show ip rpf [xxx] vrf N

and a new option is used to show routes through all VRFs:
    show ip[v6] [m]route [xxx] vrf all
    show ip rpf [xxx] vrf all

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
[DL: conflicts resolved]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/zebra_vty.c

Conflicts:
nhrpd/nhrp_interface.c
zebra/zebra_rib.c
zebra/zebra_rnh_null.c
zebra/zebra_vty.c

8 years agozebra: let FIB stand for its respective VRF
Feng Lu [Fri, 22 May 2015 09:40:02 +0000 (11:40 +0200)]
zebra: let FIB stand for its respective VRF

A new member "vrf_id" is added to "struct rib", reflecting the VRF
which it belongs to.

A new parameter "vrf_id" is added to the relative functions where
need, except those:
- which already have the parameter "vrf_id"; or
- which have a parameter in type of "struct rib"; or
- which have a parameter in type of "struct interface".

All incoming routes are set to default VRF.

In fact, all routes in FIB are kept in default VRF. And the logic
is not changed.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
[DL: conflicts fixed + compile warning fix]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/connected.c
zebra/kernel_socket.c
zebra/rib.h
zebra/rt_netlink.c
zebra/zebra_rib.c
zebra/zserv.c

Conflicts:
zebra/connected.c
zebra/interface.c
zebra/kernel_socket.c
zebra/rib.h
zebra/rt_netlink.c
zebra/rtread_getmsg.c
zebra/zebra_rib.c
zebra/zebra_vty.c
zebra/zserv.c

8 years agozebra: show interfaces in a specified VRF or all VRFs
Feng Lu [Fri, 22 May 2015 09:40:01 +0000 (11:40 +0200)]
zebra: show interfaces in a specified VRF or all VRFs

The following commands only show interfaces in the default VRF:
    show interface
    show interface IFNAME
    show interface description

New options are introduced to show interfaces in a specified VRF:
    show interface vrf N
    show interface IFNAME vrf N
    show interface description vrf N

or all VRFs:
    show interface vrf all
    show interface IFNAME vrf all
    show interface description vrf all

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
8 years agolib, zebra, vtysh: configure an interface in non-default VRF
Feng Lu [Fri, 22 May 2015 09:40:00 +0000 (11:40 +0200)]
lib, zebra, vtysh: configure an interface in non-default VRF

Introduce a new command "interface IFNAME vrf N" to configure an
interface in the non-default VRF.

Till now, only zebra uses this command. Other daemons will install
the command when they support multiple VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/interface.c

8 years agolib: move the interface list into "struct vrf"
Feng Lu [Fri, 22 May 2015 09:39:59 +0000 (11:39 +0200)]
lib: move the interface list into "struct vrf"

An interface belongs to a specific VRF. So move the interface list
into the "struct vrf".

* vrf.c/vrf.h:
  - add a new member "struct list *iflist" to the the "struct vrf";
  - call if_init() in vrf_new();
  - call if_terminate() in vrf_delete();
  - add utilities to access the interface list and VRF ID in the
    specified VRF.

* if.c/if.h:
  - the global "iflist" now only exists for the default VRF;
  - the global "if_master" is initialized on the definition;
  - in if_create(), the interface is added into the list in the
    specified VRF; if the VRF does not exist, create one;
  - add parameters to if_init()/if_terminate() so that the
    interface list in the VRF can be initialized/destroyed;
  - in if_dump_all() scan the interfaces in all the VRFs;
  - add a command "show address vrf N" to show addresses in a
    specified VRF;
  - add a command "show address vrf all" to show addresses in all
    VRFs;
  - new APIs ifxxx_vrf() are added to access an interface in a
    specified VRF.

The old interface APIs (the global variable "iflist" and the API
functions) are not changed to keep the backward compatibility.
The new APIs are used in the daemons which support multiple VRFs
(till now only zebra).

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/if.c

8 years ago*: call if_init()/if_terminate() from vrf_init()/vrf_terminate()
Feng Lu [Fri, 22 May 2015 09:39:58 +0000 (11:39 +0200)]
*: call if_init()/if_terminate() from vrf_init()/vrf_terminate()

Later, an interface will belong to a specific VRF, and the interface
initialization will be a part of the VRF initialization. So now call
if_init() from vrf_init(), and if_terminate() from vrf_terminate().

Daemons have the according changes:
- if if_init() was called or "iflist" was initialized, now call
  vrf_init() instead;
- if if_terminate() was called or "iflist" was destroyed, now call
  vrf_terminate() instead.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
bgpd/bgp_main.c
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_main.c
pimd/pimd.c

8 years agolib, zebra: add "vrf_id" into the "struct interface"
Feng Lu [Fri, 22 May 2015 09:39:57 +0000 (11:39 +0200)]
lib, zebra: add "vrf_id" into the "struct interface"

Later, an interface will belong to a specific VRF. Now we add a
property "vrf_id" to the "struct interface", and keep it as the
default value 0.

This property is shown when displaying interfaces information.
It is also added in some logs.

This is just the preparation to move the interace list into the
"struct vrf". The main logic is not changed.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/if.c
zebra/interface.c

8 years agolib, zebra: move "struct vrf" to be a lib module
Feng Lu [Fri, 22 May 2015 09:39:56 +0000 (11:39 +0200)]
lib, zebra: move "struct vrf" to be a lib module

Previously "struct vrf" is defined locally in zebra. Now it is moved
to be a lib module.

This is the first step to support multi-VRF in quagga. The
implementation is splitted into small patches for the purpose of
easy review.

* lib:
    "struct vrf" with basic members is defined in vrf.c. The member
    "void *info" is for user data.

    Some basic functions are defined in vrf.c for adding/deleting/
    looking up a VRF, scanning the VRF table and initializing the
    VRF module.

    The type "vrf_id_t" is defined specificly for VRF ID.

* zebra:
    The previous "struct vrf" is re-defined as "struct zebra_vrf";
    and previous "vrf" variables are renamed to "zvrf".

    The previous "struct vrf" related functions are removed from
    zbera_rib.c. New functions are defined to maintain the new
    "struct zebra_vrf".

    The names vrf_xxx are reserved for the functions in VRF module.
    So:
    - the previous vrf_table() are renamed to zebra_vrf_table();
    - the previous vrf_static_table() are renamed to
      zebra_vrf_static_table().

    The main logic is not changed.

    BTW: Add a statement to zebra_snmp.c telling that the SNMP is
         running only for the MIBs in the default VRF.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/Makefile.am
zebra/zebra_rib.c
zebra/zebra_vty.c

Conflicts:
lib/Makefile.am
lib/memtypes.c
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zebra_vty.c

8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Thu, 29 Oct 2015 22:25:55 +0000 (15:25 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoDeactivate BGP peer via "no neighbor x.x.x.x activate" removes other config
Daniel Walton [Thu, 29 Oct 2015 20:33:30 +0000 (20:33 +0000)]
Deactivate BGP peer via "no neighbor x.x.x.x activate" removes other config

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

8 years agoDebian: Track dependencies so that rebuilds can work right
Donald Sharp [Thu, 22 Oct 2015 00:40:39 +0000 (17:40 -0700)]
Debian: Track dependencies so that rebuilds can work right

Not the debian way, I know.  But cause the debian build to create
and follow dependencies.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP: Do appropriate cleanup on receipt of redistribute update
vivek [Thu, 29 Oct 2015 17:30:45 +0000 (10:30 -0700)]
BGP: Do appropriate cleanup on receipt of redistribute update

When there is a change to a redistributed route, either an attribute
such as the metric or the route type itself has changed, protocol clients
receive an update of the route instead of a delete and add as a result
of an earlier optimization. The update needs to be handled as an implicit
delete for any existing redistributed route, especially to handle change
in route type.

Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-7578
Reviewed By: CCR-3718
Testing Done: Manual verification
Related-to: CM-6768
8 years agoQuagga: Man pages have wrong paths
Donald Sharp [Thu, 29 Oct 2015 17:27:44 +0000 (10:27 -0700)]
Quagga: Man pages have wrong paths

Ticket: CM-8027
Testing: See bug

The man pages have the wrong paths listed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP: Check for duplicate and overlapping listen ranges
vivek [Thu, 29 Oct 2015 16:41:23 +0000 (09:41 -0700)]
BGP: Check for duplicate and overlapping listen ranges

When configuring listen ranges for allowing dynamic BGP neighbors,
ensure that there are no duplicate or overlapping ones. This is
necessary because at the time of handling an incoming connection,
the first range that matches the source of the connection (and hence,
its peer-group parameters) will be used.

Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Atul Patel <atul@cumulusnetworks.com>
Ticket: CM-5153
Reviewed By: CCR-3714
Testing Done: Manual verification

8 years agoBGP: Display the interface name used to resolve a nexthop.
vivek [Thu, 29 Oct 2015 16:34:47 +0000 (09:34 -0700)]
BGP: Display the interface name used to resolve a nexthop.

Display the interface name used to resolve a nexthop instead of just
the ifIdx. This is already done for many cases, but was missing for
one scenario.

Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-6888
Reviewed By: CCR-3705
Testing Done: Manual verification

This is an import of patch bgpd-show-ifname-for-nht.patch from 2.5-br.

8 years agolib: Memory reporting fails over 2GB
Donald Sharp [Wed, 28 Oct 2015 23:59:30 +0000 (19:59 -0400)]
lib: Memory reporting fails over 2GB

Ticket: CM-8015
Reviewed by: CCR-3717
Testing: See bug

The old style mallinfo() function uses an 'int' to
report memory usage data to the program.  Unfortunately
modern architectures can chew through 2gb of memory like a
buzz saw hitting some warm butter, especially in the case
of a memory leak or memory fragmentation.

When a daemon uses more than 2gb of memory, just indicate it's
gotten large and we don't know anymore.

Pre-change behavior:
Robot-1# show memory
System allocator statistics:
Total heap allocated: 16777216 TiB
Holding block headers: 1288 KiB
Used small blocks: 0 bytes
Used ordinary blocks: 535 MiB
Free small blocks: 768 bytes
Free ordinary blocks: 16777216 TiB
Ordinary blocks: 266107
Small blocks: 24
Holding blocks: 2

Post-change behavior:
Robot-1# show memory
System allocator statistics:
  Total heap allocated:  1572 KiB
  Holding block headers: > 2GB
  Used small blocks:     0 bytes
  Used ordinary blocks:  1443 KiB
  Free small blocks:     32 bytes
  Free ordinary blocks:  129 KiB
  Ordinary blocks:       2
  Small blocks:          1
  Holding blocks:        2

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoBGP: route-map scale
Daniel Walton [Wed, 28 Oct 2015 19:12:24 +0000 (19:12 +0000)]
BGP: route-map scale
- use a hash to store the route-maps
- reduce the number of route_map_lookup_by_name() calls in BGP

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

8 years agoBGP: peer-group restrictions should be relaxed, update-groups determine outbound...
Daniel Walton [Wed, 28 Oct 2015 01:54:48 +0000 (01:54 +0000)]
BGP: peer-group restrictions should be relaxed, update-groups determine outbound policy anyway

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Ticket: CM-7933

8 years agozebra: Fix change of distance on ipv6 route creating duplicate routes
Donald Sharp [Fri, 23 Oct 2015 02:10:54 +0000 (19:10 -0700)]
zebra: Fix change of distance on ipv6 route creating duplicate routes

If you enter:

ipv6 route 2002:44:44:44::44/128 swp1 4
ipv6 route 2002:44:44:44::44/128 swp1 99

You get:

host-111# show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S 2002:44:44:44::44/128 [99/0] is directly connected, swp1
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1

This problem is fixed in the ipv4 code path.  Copying the same
code from the ipv4 into the ipv6 code path fixes the issue.

With the fix:

host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 4
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
       > - selected route, * - FIB route

S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 99
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
       > - selected route, * - FIB route

S>* 2002:44:44:44::44/128 [99/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Sat, 24 Oct 2015 00:42:42 +0000 (17:42 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agolib: zlog_hexdump actually output printable ascii characters
Donald Sharp [Sat, 24 Oct 2015 00:10:51 +0000 (17:10 -0700)]
lib: zlog_hexdump actually output printable ascii characters

We are getting this output from zlog_hexdump:

0x00007fffdd1f9648: 45 00 00 94 ee 63 40 00 45....6340.
0x00007fffdd1f9650: 03 00 ff 0a 14 00 0f fd ........
0x00007fffdd1f9658: e8 01 01 01 45 00 00 80 ....45...
0x00007fffdd1f9660: ee 63 40 00 0a 11 75 0a .6340...75.
0x00007fffdd1f9668: 14 00 0f fd e8 01 01 01 ........
0x00007fffdd1f9670: 10 e1 10 e1 00 6c d0 54 .....6c.54
0x00007fffdd1f9678: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f9680: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f9688: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f9690: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f9698: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96a0: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96a8: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96b0: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96b8: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96c0: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96c8: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96d0: 00 00 00 00 00 00 00 00 ........
0x00007fffdd1f96d8: 00 00 00 00             ....

As you can see the ascii dump on the right is wrong and not lined
up correctly.  This commit fixes this issue:

0x00007ffcf046f228: 45 00 00 58 c6 36 40 00 E..X.6@.
0x00007ffcf046f230: 03 00 ff 73 14 00 0f fd ...s....
0x00007ffcf046f238: e8 01 01 01 45 00 00 44 ....E..D
0x00007ffcf046f240: c6 36 40 00 0a 11 9d 73 .6@....s
0x00007ffcf046f248: 14 00 0f fd e8 01 01 01 ........
0x00007ffcf046f250: 10 e1 10 e1 00 30 d0 cc .....0..
0x00007ffcf046f258: 00 00 00 00 00 00 00 00 ........
0x00007ffcf046f260: 00 00 00 00 00 00 00 00 ........
0x00007ffcf046f268: 00 00 00 00 00 00 00 00 ........
0x00007ffcf046f270: 00 00 00 00 00 00 00 00 ........
0x00007ffcf046f278: 00 00 00 00 00 00 00 00 ........

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agoMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster
Donald Sharp [Sat, 24 Oct 2015 00:14:01 +0000 (17:14 -0700)]
Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

8 years agoQuagga needs better debugs in lib/sockunion.c
Daniel Walton [Fri, 23 Oct 2015 17:36:55 +0000 (17:36 +0000)]
Quagga needs better debugs in lib/sockunion.c

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Ticket: CM-7233

8 years agoUse a hash to store BGP peer structures
Daniel Walton [Fri, 23 Oct 2015 17:34:50 +0000 (17:34 +0000)]
Use a hash to store BGP peer structures

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

8 years agoDebian: Track dependencies so that rebuilds can work right
Donald Sharp [Thu, 22 Oct 2015 00:40:39 +0000 (17:40 -0700)]
Debian: Track dependencies so that rebuilds can work right

Not the debian way, I know.  But cause the debian build to create
and follow dependencies.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Combine static_uninstall_ipv[4|6] into one function
Donald Sharp [Thu, 22 Oct 2015 02:19:14 +0000 (22:19 -0400)]
zebra: Combine static_uninstall_ipv[4|6] into one function

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: combine static_ipv[4|6]_nexthop_same into one function
Donald Sharp [Thu, 22 Oct 2015 02:10:52 +0000 (22:10 -0400)]
zebra: combine static_ipv[4|6]_nexthop_same into one function

Combine the static_ipv[4|6]_nexthop_same into static_nexthop_same.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
8 years agozebra: Combine static_install_ipv[4|6]
Donald Sharp [Thu, 22 Oct 2015 01:58:16 +0000 (21:58 -0400)]
zebra: Combine static_install_ipv[4|6]

Combine the static_install_ipv[4|6] function calls into
static_install_route.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>