Commit Graph

1030 Commits

Author SHA1 Message Date
Donald Sharp
2089dd80c0 bgpd: Fix spelling mistakes found by debian packaging
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-13 19:10:28 -04:00
Donald Sharp
2a0e69ae3c bgpd: Add 'show bgp listeners' command for diagnostics
Add a command to display listen sockets and the vrf that they
are associated with.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-10 09:59:56 -04:00
Quentin Young
498897d8d8
Merge pull request #5918 from ton31337/fix/__func__everywhere
__func__ everywhere
2020-03-05 17:37:03 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Quentin Young
fbb0740683
Merge pull request #5911 from ton31337/fix/no_check_if_assert
bgpd: Remove a test and return statement after assert
2020-03-05 13:16:30 -05:00
Donatas Abraitis
ce089777d4 bgpd: Remove a test and return statement after assert
No need to check if the variable is NULL and return after assert.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 20:19:12 +02:00
Donatas Abraitis
08c2d52ae1 *: Use true/false instead of 1/0 when assigning variable for bool type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 18:49:36 +02:00
Donatas Abraitis
40b0108887
Merge pull request #5788 from karamalla0406/large_comm
bgpd: support 'show ip bgp large-community" on default vrf
2020-02-19 21:03:59 +01:00
Donald Sharp
1a21da6b01
Merge pull request #5802 from ton31337/feature/aggregate-address_origin_override
bgpd: Allow overriding ORIGIN for aggregate-address
2020-02-19 08:38:31 -05:00
Donatas Abraitis
0bdcc3e3ef
Merge pull request #5809 from donaldsharp/vrf_name
Print out vrf name as well as id
2020-02-19 14:23:32 +01:00
Sri Mohana Singamsetty
dea8e5f275
Merge pull request #5801 from donaldsharp/bgp_peer_sort
Bgp peer sort
2020-02-17 21:39:37 -08:00
Donald Sharp
137147c66a bgpd: Print out vrf name as well as id
The vrf_id is not enough context for people.  Use the
actual name of the vrf if you can.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 08:44:27 -05:00
Donatas Abraitis
752022670a *: Remove break after return
Just a deadcode.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 15:39:54 +02:00
Donatas Abraitis
229757f195 bgpd: Allow overriding ORIGIN for aggregate-address
Override ORIGIN attribute if defined.
E.g.: Cisco and Juniper set ORIGIN for aggregated address
to IGP which is not what rfc4271 says.

This enables the same behavior, optionally.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 11:07:40 +02:00
Donald Sharp
bf0d28dcf7 bgpd: Create peer_sort_lookup()
The act of peer_sort() being called always set this value
even when we are just looking it up.  We need to seperate
out the idea of lookup from set.

For those places that this is immediately obvious that
this is a lookup switch over to using this function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 14:45:06 -05:00
Kishore Aramalla
4d6784636c bgpd: support 'show ip bgp large-community" on default vrf
This command works only in the case of vrf/view.
Adding support for default VRF as well.

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2020-02-11 12:38:25 -08:00
Donatas Abraitis
892fedb611 bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros
Most of the code uses macros, thus let's keep the code unified.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 17:11:38 +02:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Donatas Abraitis
85c58de773
Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft
Fix bgp gr style
2020-02-06 08:16:25 +02:00
Renato Westphal
ecaeb3b697
Merge pull request #5750 from qlyoung/fix-null-after-xfree
*: don't null after XFREE; XFREE does this itself
2020-02-05 01:49:08 -03:00
Quentin Young
362353195a bgpd, lib: fix style from BGP GR code
This patch fixes the noncompliant style for the following commit range:

4a6e80fbf
2ba1fe695
efcb2ebbb
8c48b3b69
dc95985fe
0f0444fbd
85ef4179a
eb451ee58
2d3dd828d
9e3b51a7f
d6e3c15b6
34aa74486
6102cb7fe
d7b3cda6f
2bb5d39b1
5f9c1aa29
5cce3f054
3a75afa4b
f009ff269
cfd47646b
2986cac29
055679e91
034e185dc
794b37d52
b0965c44e
949b0f24f
63696f1d8

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 15:19:04 -05:00
Quentin Young
e1b36e132b *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 13:19:37 -05:00
Donald Sharp
7f1ace03c7
Merge pull request #5653 from slankdev/slankdev-bgpd-support-prefix-sid-srv6-l3vpn
bgpd: additional Prefix-SID sub-types for supporting SRv6 l3vpn
2020-02-04 11:37:10 -05:00
Donald Sharp
5f71d11c12 bgpd: Tell Coverity SA that regex cannot be NULL here
The coverity SA believes that the regex value can possibly
be NULL.  Not possible so let's make it happy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-04 08:09:15 -05:00
Quentin Young
b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Donald Sharp
13909c4fbc bgpd: Cleanup some bad formating
Some recent commits got some bad formating.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-31 09:59:57 -05:00
bisdhdh
2ba1fe6951 bgpd: BGP Garaceful Restart debug logs.
Reorganizing bgp gr debug logs and code review comments.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:36:33 +05:30
bisdhdh
8c48b3b696 bgpd: Adding bgp peer route processing and EOR state Signalling from BGPD to Zebra.
* While the Deferral timer is running, signal route update pending
(ZEBRA_CLIENT_ROUTE_UPDATE_PENDING) from BGPD to Zebra.
* After expiry of the Deferral timer, the deferred routes are processed.
When the deferred route_list becomes empty, End-of-Rib is send to the
peer and route processing complete message (ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE)
is sent to Zebra. So that Zebra would delete any stale routes still
present in the rib.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:36:33 +05:30
bisdhdh
9e3b51a7f3 bgpd: Restarting node does not send EOR after the convergence.
*After a restarting router comes up and the bgp session is
successfully established with the peer. If the restarting
router doesn’t have any route to send, it send EOR to
the peer immediately before receiving updates from its peers.
*Instead the restarting router should send EOR, if the
selection deferral timer is not running OR count of eor received
and eor required are matches then send EOR.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
5f9c1aa29e bgpd: Fix for BGP core when connected routes are redistributed
& GR is enabled.

When GR with deferral is enabled and connected routes are
distributed then in one race condition route node gets added
in to both deferred queue and work queue. If deferred queue
gets processed first then it ends up delete only flag while
leaving the entry in the work queue as it is. When a new update
comes for the same route node next time from peer then it hits
assert. Assert check is added to ensure we don’t add to work queue
again while it is already present.
So, check before adding in to deferred queue if it is already present
in work queue and bail if so.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
f009ff2697 bgpd: Adding Selection Deferral Timer handler changes.
* Selection Deferral Timer for Graceful Restart.
* Added selection deferral timer handling function.
* Route marking as selection defer when update message is received.
* Staggered processing of routes which are pending best selection.
* Fix for multi-path test case.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
Hiroki Shirokura
e496b42030 bgpd: prefix-sid srv6 l3vpn service tlv
bgpd already supports BGP Prefix-SID path attribute and
there are some sub-types of Prefix-SID path attribute.
This commits makes bgpd to support additional sub-types.
sub-Type-4 and sub-Type-5 for construct the VPNv4 SRv6 backend
with vpnv4-unicast address family.
This path attributes is already supported by Ciscos IOS-XR and NX-OS.

Prefix-SID sub-Type-4 and sub-Type-5 is defined on following
IETF-drafts.

Supports(A-part-of):
- https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-04
- https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-05

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2020-01-15 18:20:35 +09:00
Santosh P K
a3a850a17d bgpd: fix unaligned access to addpath id
uint8_t * cannot be cast to uint32_t * unless the
pointed-to address is aligned according to uint32_t's
alignment rules. And it usually is not.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-01-07 07:47:13 -08:00
Quentin Young
454d85cf62 bgpd: fix unaligned access to addpath id
uint8_t * cannot be cast to uint32_t * unless the pointed-to address is
aligned according to uint32_t's alignment rules. And it usually is not.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-06 20:09:23 -05:00
Jafar Al-Gharaibeh
80bbad684b
Merge pull request #5545 from ton31337/feature/show_bgp_json_regexp
bgpd: Print json output for show_ip_bgp_regexp_cmd
2020-01-06 11:03:55 -06:00
Donatas Abraitis
e0df4c04a0 bgpd: Do not apply eBGP policy for iBGP peers
Treat iBGP peers as they have a policy applied.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-19 10:52:04 +02:00
Donatas Abraitis
f4ec52f7cc bgpd: Print pretty json output for bgp_show_table()
This is not very cool:

```
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 4,
 "routerId": "192.168.0.1",
 "defaultLocPrf": 100,
 "localAS": 200,
 "routes": { "10.0.0.150/32": [{"valid":true,"bestpath":true,"pathFrom":"external","prefix":"10.0.0.150","prefixLen":32,"network":"10.0.0.150\/32","med":0,"metric":0,"weight":32768,"peerId":"(unspec)","aspath":"200 200 200","path":"200 200 200","origin":"incomplete","nexthops":[{"ip":"0.0.0.0","afi":"ipv4","used":true}]}],"10.0.0.200/32": [{"valid":true,"bestpath":true,"pathFrom":"external","prefix":"10.0.0.200","prefixLen":32,"network":"10.0.0.200\/32","med":0,"metric":0,"weight":32768,"peerId":"(unspec)","aspath":"200 200 200","path":"200 200 200","origin":"incomplete","nexthops":[{"ip":"0.0.0.0","afi":"ipv4","used":true}]}],"10.0.2.0/24": [{"valid":true,"bestpath":true,"pathFrom":"external","prefix":"10.0.2.0","prefixLen":24,"network":"10.0.2.0\/24","med":0,"metric":0,"weight":32768,"peerId":"(unspec)","aspath":"200 200 200","path":"200 200 200","origin":"incomplete","nexthops":[{"ip":"0.0.0.0","afi":"ipv4","used":true}]}],"192.168.0.0/24": [{"valid":true,"bestpath":true,"pathFrom":"external","prefix":"192.168.0.0","prefixLen":24,"network":"192.168.0.0\/24","med":0,"metric":0,"weight":32768,"peerId":"(unspec)","aspath":"200 200 200","path":"200 200 200","origin":"incomplete","nexthops":[{"ip":"0.0.0.0","afi":"ipv4","used":true}]}] }  }
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-17 12:49:30 +02:00
Donatas Abraitis
157a43d572 bgpd: Adjust warning message for bgp_show_regexp()
Before it was:
```
exit1-debian-9# show ip bgp regexp ^200a
Invalid character in as-path access-list ^200a
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-17 12:39:40 +02:00
Donatas Abraitis
3e5b31b37d bgpd: Print json output for show_ip_bgp_regexp_cmd
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-17 12:37:08 +02:00
Sri Mohana Singamsetty
8887295390
Merge pull request #5502 from ton31337/fix/rr_do_not_show_fqdn
bgpd: Show `ip` and `fqdn` in json output for `show [ip] bgp json`
2019-12-16 09:43:01 -08:00
Sri Mohana Singamsetty
b332774896
Merge pull request #5379 from pogojotz/fix-bgp-neighbors-prefix-count-segfault
bgpd: Special handling for 2-level routing tables
2019-12-16 09:41:35 -08:00
Donatas Abraitis
515c260288 bgpd: Show ip and fqdn in json output for show [ip] bgp <route> json
This should keep backward compatibility when bgp show-hostname is
enabled/disabled.

Also show the real originator IP instead of showing fqdn of the route
reflector.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-12 10:35:29 +02:00
Quentin Young
6f4f49b237 bgpd: remove bgp_attr_dup
yeah

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-05 11:05:32 -05:00
Donald Sharp
2d3c8c2957
Merge pull request #5305 from ton31337/feature/draft-ietf-idr-deprecate-as-set-confed-set
bgpd: Reject incoming and outgoing UPDATES for AS_SET and AS_CONFED_SET
2019-12-03 21:29:09 -05:00
Donald Sharp
8abe686a3e
Merge pull request #5389 from opensourcerouting/constify
*: constify ALL the things
2019-12-02 11:26:11 -05:00
David Lamparter
2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
Donald Sharp
1f83ed0264 bgpd: Fix memory leak in json output of show commands
When dumping a large bit of table data via bgp_show_table
and if there is no information to display for a particular
`struct bgp_node *` the data allocated via json_object_new_array()
is leaked.  Not a big deal on small tables but if you have a full
bgp feed and issue a show command that does not match any of
the route nodes ( say `vtysh -c "show bgp ipv4 large-community-list FOO"`)
then we will leak memory.

Before code change and issuing the above show bgp large-community-list command 15-20 times:
Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  > 2GB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  > 2GB
  Free small blocks:     31 MiB
  Free ordinary blocks:  616 KiB
  Ordinary blocks:       0
  Small blocks:          0
  Holding blocks:        0

After:

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  924 MiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  558 MiB
  Free small blocks:     26 MiB
  Free ordinary blocks:  340 MiB
  Ordinary blocks:       0
  Small blocks:          0
  Holding blocks:        0

Please note the 340mb of free ordinary blocks is from the fact I issued a
`show bgp ipv4 uni json` command and generated a large amount of data.

Fixes: #5445
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-01 09:29:32 -05:00
Donatas Abraitis
c8d6f0d6c4 bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
For readability and maintainability purposes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 10:48:17 +02:00
Donatas Abraitis
3e1cc63a5f
Merge pull request #5419 from adharkar/frr-master-nh_connected
bgpd: Do not perform "connected" check for EVPN nexthop
2019-11-27 10:37:11 +02:00
Russ White
2f7b0479e9
Merge pull request #5408 from donaldsharp/scan7
Scan7
2019-11-26 09:48:20 -05:00
Quentin Young
761ed66524 bgpd: fix bad bounds check for addpath in nlri
If a peer advertised capability addpath in their OPEN, but sent us an
UPDATE without an ADDPATH, we overflow a heap buffer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-24 02:48:11 -05:00
Ameya Dharkar
41a28a265b bgpd: Do not perform "connected" check for EVPN nexthop
This changeset follows the PR
https://github.com/FRRouting/frr/pull/5334

Above PR adds nexthop tracking support for EVPN RT-5 nexthops.
This route is marked VALID only if the BGP route has a valid nexthop.

If the EVPN peer is an EBGP pee and "disable_connected_check" flag is not set,
"connected" check is performed for the EVPN nexthop.
But, usually EVPN nexthop is not the BGP peering address, but the VTEP address.
Also, NEXTHOP_UNCHANGED flag is enabled by default for EVPN.
As a result, in a common deployment for EVPN, EVPN nexthop is not connected.

Thus, adding a fix to remove the "connected" check for EVPN nexthops.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-11-22 15:48:37 -08:00
Donald Sharp
6d24b7cc08 bgpd: Prevent possible SA thinking we'll divide by zero
The half and reuse variables can never be 1 but the
SA systems we have do not know this and think it is possible.
Provide the kick in the snarples that the SA needs to know
this is not true.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-21 19:41:48 -05:00
bisdhdh
949b0f24fa bgpd: Implementing a hash table for connected address - ipv4/ipv6
* IPv6 routes received via a ibgp session with one of its own interface as
nexthop are getting installed in the BGP table.
*A common table to be implemented should take cares of both
ipv4 and ipv6 connected addresses.

Signed-off-by: Biswajit Sadhu sadhub@vmware.com
2019-11-20 01:23:11 +05:30
Juergen Werner
54317cbae5 bgpd: Special handling for 2-level routing tables
The command `show ip bgp ipv4|ipv6 vpn neighbors <ip> prefix-counts`
caused a segfault, because the 2-level routing was not accounted for.

Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-11-19 17:41:04 +01:00
Sri Mohana Singamsetty
6580da9f54
Merge pull request #5257 from ton31337/fix/update_rib_on_bgp_distance_changes
bgpd: Reflect the distance in RIB when it is changed for an arbitrary afi/safi
2019-11-19 08:35:57 -08:00
Lakshman Krishnamoorthy
62e43fd7a8 bgpd: Bug fix in "show bgp l2vpn evpn X:X::X:X/M"
The CLI was not parsing prefix format of ipv6 address.
This fixes the bug: https://github.com/FRRouting/frr/issues/5322

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-11-18 18:20:21 -08:00
Donatas Abraitis
839bdd0f45
Merge pull request #5334 from adharkar/frr-master-nexthop_check
bgpd: Add nexthop of received EVPN RT-5 for nexthop tracking
2019-11-18 09:57:01 +02:00
Ameya Dharkar
7c312383ba bgpd: Add nexthop of received EVPN RT-5 for nexthop tracking
Problem statement:
When IPv4/IPv6 prefixes are received in BGP, bgp_update function registers the
nexthop of the route with nexthop tracking module. The BGP route is marked as
valid only if the nexthop is resolved.

Even for EVPN RT-5, route should be marked as valid only if the the nexthop is
resolvable.

Code changes:
1. Add nexthop of EVPN RT-5 for nexthop tracking. Route will be marked as valid
only if the nexthop is resolved.
2. Only the valid EVPN routes are imported to the vrf.
3. When nht update is received in BGP, make sure that the EVPN routes are
imported/unimported based on the route becomes valid/invalid.

Testcases:
1. At rtr-1, advertise EVPN RT-5 with a nexthop 10.100.0.2.
10.100.0.2 is resolved at rtr-2 in default vrf.
At rtr-2, remote EVPN RT-5 should be marked as valid and should be imported into
vrfs.

2. Make the nexthop 10.100.0.2 unreachable at rtr-2
Remote EVPN RT-5 should be marked as invalid and should be unimported from the
vrfs. As this code change deals with EVPN type-5 routes only, other EVPN routes
should be valid.

3. At rtr-2, add a static route to make nexthop 10.100.0.2 reachable.
EVPN RT-5 should again become valid and should be imported into the vrfs.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-11-15 10:15:14 -08:00
Lakshman Krishnamoorthy
196c6b092d bgpd: route-map support for evpn RD filter
With this code change, we can now filter evpn routes based on RD using the
match statement: "match evpn rd XX"

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-11-14 13:40:25 -08:00
Donatas Abraitis
fb29348a19 bgpd: Reject routes having AS_SET or AS_CONFED_SET
This is the first step towards eliminating AS_SET and AS_CONFED_SET types
and obsolete them in the future.

More information:
https://datatracker.ietf.org/doc/html/draft-ietf-idr-deprecate-as-set-confed-set-02

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-14 19:19:04 +02:00
Donatas Abraitis
8b54bc30f0 tests: Test if distance bgp (1-255) (1-255) (1-255) works
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-14 10:13:02 +02:00
Donatas Abraitis
a935f597fc bgpd: Rework BGP dampening to be per AFI/SAFI
Before we had:

!
router bgp 65031
 bgp dampening 1 2 3 4
!

exit2-debian-9(config)# router bgp 65031
exit2-debian-9(config-router)# address-family ipv4 multicast
exit2-debian-9(config-router-af)# bgp dampening 5 6 7 8
exit2-debian-9(config-router-af)# end
exit2-debian-9# show running-config

!
router bgp 65031
 bgp dampening 1 2 3 4
!

After fix:

!
router bgp 65031
 neighbor 192.168.1.2 remote-as 100
 !
 address-family ipv4 unicast
  bgp dampening 1 2 3 4
 exit-address-family
 !
 address-family ipv4 multicast
  bgp dampening 5 6 7 8
 exit-address-family
!

exit2-debian-9# show ip bgp ipv4 unicast dampening parameters
Half-life time: 1 min
Reuse penalty: 2
Suppress penalty: 3
Max suppress time: 4 min
Max suppress penalty: 32

exit2-debian-9# show ip bgp ipv4 multicast dampening parameters
Half-life time: 5 min
Reuse penalty: 6
Suppress penalty: 7
Max suppress time: 8 min
Max suppress penalty: 18

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-11 09:52:40 +02:00
Russ White
a049e601ec
Merge pull request #5281 from bisdhdh/bgpv4-over-v6-1
BGPD: Prevent IPv6-LL being fwd to IBGP peers not on same link.
2019-11-06 14:03:52 -05:00
bisdhdh
63696f1d89 BGPD: Prevent IPv6-LL being fwd to IBGP peers not on same link.
Prevent IPv6 Link-local address being forward to IBGP peer,
which are not directly connected.

R1----IPV6-unnumbered-EBGP-------R2-----IPV6-IBGP-----R3

Configure route-map to set preferred global address on and apply
route-map-IN on R2 for R1-R2 session. Now check on R3's BGP and
RIB table has route nexthop as R1 link-local address, which is
not correct.

As of now we clear link-local address info from mp_nexthop_global,
only if mp_nexthop_global is populated with link-local address.

We should do it even if route-map is configured boz forwarding
link-local address from one link scope to another is violation of
the standards.

Signed-off-by: Biswajit Sadhu sadhub@vmware.com
2019-11-05 11:17:47 +05:30
Donald Sharp
63265b5c1f *: Convert prefix_free to double pointer
Have the prefix_free code take a double pointer to free the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Donatas Abraitis
a612fb77d5 bgpd: Reflect the distance in RIB when it is changed for an arbitrary afi/safi
debian-9# show ip route 192.168.255.2/32 longer-prefixes
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

B>* 192.168.255.2/32 [20/0] via 192.168.0.1, eth1, 00:15:22
debian-9# conf
debian-9(config)# router bgp 100
debian-9(config-router)# address-family ipv4
debian-9(config-router-af)# distance bgp 123 123 123
debian-9(config-router-af)# do show ip route 192.168.255.2/32 longer-prefixes
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

B>* 192.168.255.2/32 [123/0] via 192.168.0.1, eth1, 00:00:09
debian-9(config-router-af)# no distance bgp
debian-9(config-router-af)# do show ip route 192.168.255.2/32 longer-prefixes
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

B>* 192.168.255.2/32 [20/0] via 192.168.0.1, eth1, 00:00:02
debian-9(config-router-af)#

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-31 09:53:18 +02:00
Rafael Zalamena
2b31007ca2 bgpd: expose sender side AS path loop detection
The sender side AS path loop detection code was implemented since the
import of Quagga code, however it was always disabled by a `ifdef`
guard.

Lets allow the user to decide whether or not to enable this feature on
run-time.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-29 16:29:09 -03:00
Donald Sharp
50f450bd53
Merge pull request #4941 from ton31337/fix/do_not_include_nexthop_dash_dash
bgpd: Do not send next-hop as :: in MP_REACH_NLRI if no link-local ex…
2019-10-29 09:37:04 -04:00
Donald Sharp
22df2d8aaf bgpd: Logically dead code
SAFI_EVPN and SAFI_MPLSVPN have been excluded by previous
if statements.  This code is dead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 20:42:21 -04:00
Russ White
12bea6d575
Merge pull request #4850 from lkrishnamoor/show_cli
bgpd: Adding new bgp evpn cli's for ip-prefix lookup
2019-10-18 21:30:37 -04:00
Renato Westphal
dfd7b62ddd
Merge pull request #5172 from donaldsharp/sa_clean_and_clean
Sa clean and clean
2019-10-17 23:14:31 -03:00
Russ White
718804149e
Merge pull request #5078 from lkrishnamoor/advertise-routes
bgpd: Fix "show bgp l2vpn evpn neighbors x.x.x.x advertised-routes json"
2019-10-16 15:05:23 -04:00
Donald Sharp
401b063670 bgpd: In redistribution aspath cannot be NULL
Coverity has found a path where the attr.aspath may be NULL.

assert that the aspath is non-null so we can make this go away.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 13:38:29 -04:00
Donald Sharp
05864da791 bgpd: struct bgp_path_info *->attr must not be NULL
We make the assumption that ->attr is not NULL throughout
the code base.  We are totally inconsistent about application
of this though.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 13:38:29 -04:00
Russ White
e9f66ba9af
Merge pull request #5156 from donaldsharp/soft_reconfig_the_peer
bgpd: Soft reconfig-in should find the right bgp_path_info
2019-10-15 11:37:07 -04:00
Donald Sharp
d7d158892a bgpd: Soft reconfig-in should find the right bgp_path_info
When using soft reconfiguration inbound we are storing packet
data on the side for replaying when necessary.  The problem here
is that we are just grabbing the first bgp_path_info and using
that as the base.  What happens when we have soft-reconfig turned
on with multiple bgp_path_info's for a path?  This was introduced
in commit 8692c50652, yes back
in 2012!  I would argue, though, that it was just broken
in a different way before this.

Choose the correct bgp_path_info that corresponds to the peer
we received the data from for rethinking.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-15 09:31:20 -04:00
Donald Sharp
a51743300c bgpd: Be careful about displaying vni's as labels.
When a type 2/3 or 5 route is received, verified and the
resulting route generated is pushed into the appropriate vrf
the vni's associated with the route are also passed in.
This is showing up as a Remote label when you dump
the route in bgp:

BGP routing table entry for 0.0.0.0/0^M
Paths: (1 available, best #1, table third)
   Advertised to non peer-group peers:
   10.10.120.22
   42001 42005 42006 42055
     10.10.120.22 from 10.10.120.22 (10.10.255.193)
       Origin IGP, valid, external, bestpath-from-AS 42001, best
       Remote label: 62750
       AddPath ID: RX 0, TX 2
       Last update: Fri Oct 11 12:59:56 2019

The `Remote label: 62750` is the mpls label version of the
vni passed in.  This is meaningless and confusing to the end
user.  Do not display this information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-14 21:17:16 -04:00
Russ White
adca8385ae
Merge pull request #5131 from donaldsharp/extra_clean
bgpd: When creating extra from stack ensure it is zero'ed out
2019-10-11 07:24:39 -04:00
Philippe Guibert
1276ce3833 bgpd: withdraw fib entry on appropriate table identifier
There are cases where the table identifier is set on a bgp entry, mainly
due to route-map, and associate fib entry needs to be removed.
This change encompasses also the route-map reconfiguration that leads to
removing the previous entry, whereas bgp update had been triggered (
this happens when software inbound reconfiguration is handled).

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-10-10 16:06:51 +02:00
Donald Sharp
b8694ef44c bgpd: When creating extra from stack ensure it is zero'ed out
BGP code assumes that the extra data is zero'ed out.  Ensure that we
are not leaving any situation that the data on the stack is actually all
0's when we pass it around as a pointer later.

Please note in issue #5025, Lou reported a different valgrind
issue, which is not the same issue:

==7313== Conditional jump or move depends on uninitialised value(s)
==7313== at 0x181F9F: subgroup_announce_check (bgp_route.c:1555)
==7313== by 0x1A112B: subgroup_announce_table (bgp_updgrp_adv.c:641)
==7313== by 0x1A1340: subgroup_announce_route (bgp_updgrp_adv.c:704)
==7313== by 0x1A13E3: subgroup_coalesce_timer (bgp_updgrp_adv.c:331)
==7313== by 0x4EBA615: thread_call (thread.c:1531)
==7313== by 0x4E8AC37: frr_run (libfrr.c:1052)
==7313== by 0x1429E0: main (bgp_main.c:486)
==7313==
==7313== Conditional jump or move depends on uninitialised value(s)
==7313== at 0x201C0E: rfapi_vty_out_vncinfo (rfapi_vty.c:429)
==7313== by 0x18D0D6: route_vty_out (bgp_route.c:7481)
==7313== by 0x18DD76: bgp_show_table (bgp_route.c:9365)
==7313== by 0x1930C4: bgp_show_table_rd (bgp_route.c:9471)
==7313== by 0x1932A3: bgp_show (bgp_route.c:9510)
==7313== by 0x193E68: show_ip_bgp_json (bgp_route.c:10284)
==7313== by 0x4E6D024: cmd_execute_command_real.isra.2 (command.c:1072)
==7313== by 0x4E6F51E: cmd_execute_command (command.c:1131)
==7313== by 0x4E6F686: cmd_execute (command.c:1285)
==7313== by 0x4EBF9C4: vty_command (vty.c:516)
==7313== by 0x4EBFB9F: vty_execute (vty.c:1285)
==7313== by 0x4EC250F: vtysh_read (vty.c:2119)
==7313==

that is causing the actual crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-10 09:03:56 -04:00
Donatas Abraitis
a0a87037ac bgpd: Use uint32_t for maximum-prefix
Currently we have unsigned long which is not what we defined
in CLI (1-4294967295).

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-04 15:46:21 +03:00
Lakshman Krishnamoorthy
dc387b0fea bgpd: Fixing "show bgp l2vpn evpn neighbors x.x.x.x advertised-routes json
Display output from adj_out instead of the rib table.

Also fixes crash for the json output. RCA: prefix is written to json object
using inet_ntop. But, this api returns null buffer for AF_EVPN address family
(it works only for AF_INET and AF_INET6).  This null buffer is then deref'd
by json-object-to string api.

Full output shown in PR: https://github.com/FRRouting/frr/pull/5078
Crash issue: https://github.com/FRRouting/frr/issues/5010

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-09-27 12:04:13 -07:00
Lakshman Krishnamoorthy
44c6974748 bgpd: Adding new bgp evpn cli's for ip-prefix lookup
Implement CLIs for the following, to filter for a prefix within
evpn type 5 route
1) show bgp l2vpn evpn A.B.C.D
2) show bgp l2vpn evpn A.B.C.D json
3) show bgp l2vpn evpn A.B.C.D/M
4) show bgp l2vpn evpn A.B.C.D/M json
5) show bgp l2vpn evpn X:X::X:X
6) show bgp l2vpn evpn X:X::X:X json
7) show bgp l2vpn evpn X:X::X:X/M
8) show bgp l2vpn evpn X:X::X:X/M json

Sample output provided here: https://github.com/FRRouting/frr/pull/4850

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-09-27 10:58:46 -07:00
Donald Sharp
cb70bd5638
Merge pull request #5067 from ton31337/fix/no_aggregate-address_command_for_route-map
bgpd: Accept no aggregate-address <IP> route-map <RMAP> commands
2019-09-26 17:40:41 -04:00
Donald Sharp
961f406493
Merge pull request #5070 from ton31337/fix/aggregate-address_for_ipv6_summary-only_missreading
bgpd: aggregate-address X:X::X:X/M summary-only was missreading config
2019-09-26 17:39:09 -04:00
Donatas Abraitis
273fae13b2 bgpd: aggregate-address X:X::X:X/M summary-only was missreading config
Entering:
aggregate-address 2a02:4780::/48 summary-only

Will transform this to:
aggregate-address 2a02:4780::/48 summary-only route-map summary-only

This patch fixes that.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-09-26 21:47:55 +03:00
Donald Sharp
cf40d0528e bgpd: aggregate-address A.B.C.D A.B.C.D summary-only was missreading config
The `aggregate-address 30.0.5.0 255.255.255.0 summary-only` command
was missreading the inputed data and translating it into:

`aggregate-address 30.0.5.0/24 summary-only route-map summary-only`

This is not quite correct.  Fix this behavior:

donna.cumulusnetworks.com# conf
donna.cumulusnetworks.com(config)# router bgp
donna.cumulusnetworks.com(config-router)# aggregate-address 30.0.5.0 255.255.255.0 summary-only
donna.cumulusnetworks.com(config-router)# do show run
Building configuration...

Current configuration:
!
frr version 7.3-dev
frr defaults datacenter
hostname donna.cumulusnetworks.com
log file /var/log/frr/frr.log
no ipv6 forwarding
frr version 7.2-dev
!
router bgp 500
 neighbor 192.168.209.1 remote-as external
 neighbor 192.168.209.1 ebgp-multihop 255
 neighbor 192.168.210.1 remote-as external
 !
 address-family ipv4 unicast
  network 192.168.9.0/24
  network 192.168.10.0/24
  aggregate-address 30.0.5.0/24 summary-only
 exit-address-family
!

Issue: #5054
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-26 12:40:19 -04:00
Donatas Abraitis
b84da0db76 bgpd: Accept no aggregate-address <IP> route-map <RMAP> commands
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-09-26 17:35:25 +03:00
vdhingra
ef51a7d8d4 bgpd : route agg. with aspath attribute is consuming lot of cycles.
While configuring aggregate route prepare the hash table first,
then prepare the aggregated aspath value just like lcomm,
ecomm and standard community.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-09-24 02:54:19 -07:00
vdhingra
4edd83f91b bgpd : route agg. with ecomm attribute is consuming lot of cycles.
While configuring aggregate route prepare the hash table first,
then prepare the aggregated ecomm value and then do the
unique sort once for ecommunity.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-09-24 02:54:19 -07:00
vdhingra
21fec67453 bgpd : route agg. with comm attr is consuming lot of cycles.
While configuring aggregate route prepare the hash table
first, then prepare the aggregated standard comm value
and then do the unique sort once for standard community.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
2019-09-24 02:54:19 -07:00
vdhingra
f1eb1f0526 bgpd : route agg. with lcomm attribute is consuming lot of cycles.
While configuring aggregate route prepare the hash table first,
then prepare the aggregated lcomm value and then do the unique
sort once for large community.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-24 02:53:51 -07:00
Donald Sharp
7b7d48e586 bgpd: Create set distance XXX command for routemaps
Allow bgp to set a local Administrative distance to use
for installing routes into the rib.

Example:
!
router bgp 9323
 bgp router-id 1.2.3.4
 neighbor enp0s8 interface remote-as external
 !
 address-family ipv4 unicast
  neighbor enp0s8 route-map DISTANCE in
 exit-address-family
!
route-map DISTANCE permit 10
 set distance 153
!
line vty
!
end
eva# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

B   0.0.0.0/0 [153/0] via fe80::a00:27ff:fe84:c2d6, enp0s8, 00:00:06
K>* 0.0.0.0/0 [0/100] via 10.0.2.2, enp0s3, 00:06:31
B>* 1.1.1.1/32 [153/0] via fe80::a00:27ff:fe84:c2d6, enp0s8, 00:00:06
B>* 1.1.1.2/32 [153/0] via fe80::a00:27ff:fe84:c2d6, enp0s8, 00:00:06
B>* 1.1.1.3/32 [153/0] via fe80::a00:27ff:fe84:c2d6, enp0s8, 00:00:06
C>* 10.0.2.0/24 is directly connected, enp0s3, 00:06:31
K>* 169.254.0.0/16 [0/1000] is directly connected, enp0s3, 00:06:31
eva#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-13 16:43:16 -04:00
Donatas Abraitis
0606039c19 bgpd: Use defined constants for NHLEN instead of numeric values
This is better in cases when you need to find specific pattern and/or
replacing.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-09-13 11:43:44 +03:00
Lou Berger
ccc13acc0f
Merge pull request #4866 from ton31337/feature/apply_route-map_for_aggregate-address
bgpd: Apply route-map for aggregate-address
2019-09-10 11:59:10 -04:00
Donatas Abraitis
c728d02764 bgpd: Do not send next-hop as :: in MP_REACH_NLRI if no link-local exists
This is the unusual case when you have global IPv6 address and no link-local
on interface attached. Like here:

eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
 link/ether 08:00:27:65:c6:82 brd ff:ff:ff:ff:ff:ff
 inet6 2a02:4780:face::1/64 scope global
    valid_lft forever preferred_lft forever

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-09-10 18:11:58 +03:00
Donatas Abraitis
20894f50bd bgpd: Apply route-map for aggregate-address command
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-08-28 16:45:21 +03:00
Dinesh G Dutt
5cb5f4d04d bgpd: Eliminate all incorrect formulations of afi/safi in JSON
In a number of places, the JSON output had invalid key names for
AFI/SAFI. For example, the key name in JSON was "IPv4 Unicast" which
is invalid as a JSON Key name. Many JSON tools such as those used in
Ansible, jq etc. all fail to parse the output in these scenarios. The
valid name is ipv4Unicast. There's already a routine afi_safi_json()
defined to handle this change, but it was not consistently called.
The non-JSON version was called afi_safi_print() and it merely returned
the CLI version of the string, didn't print anything.

This patch deals with this issue by:
   - Renaming afi_safi_print to get_afi_safi_str()
   - get_afi_safi_str takes an additional param, for_json which if true
     will return the JSON-valid string
   - Renaming afi_safi_json to get_afi_safi_json_str()
   - Creating a new routine get_afi_safi_vty_str() for printing to vty
   - Consistently using get_afi_safi_str() with the appropriate for_json
     value

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-08-27 14:05:39 +00:00
Dinesh Dutt
d7325ee773 bgpd: Display the imported route information for EVPN routes
For IPv4/v6 unicast routes that have been imported from EVPN Prefix
routes, display the information about where the route has been imported
from allowing for easy tracing of how a FIB/RIB entry got populated.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-08-14 19:27:56 +00:00