Commit Graph

4777 Commits

Author SHA1 Message Date
Mark Stapp
fb06b39ca8
Merge pull request #7854 from patrasar/2606829
bgpd : multiple memory leak fixes in show commands
2021-01-22 08:21:27 -05:00
Sarita Patra
d5f2046840 bgpd : multiple memory leak fixes in show commands
Issue: bgpd got kill due to out of memory, when show bgp
neighbor json and show ip bgp neighbor <ip> routes json
commands executed multiple times in a setup having 320554
routes.

RCA: Heap allocated for bgpd keeps increasing. This is verified
using top command and show memory command.

Memleak Fix-1: show ip bgp route json command
When dumping a large bit of table data via bgp_show_route
and if there is no information to display for a particular
struct bgp_node *` the data allocated via json_object_new_array()
is not freed. This is resolved now.

Memleak Fix-2:
The function bgp_peer_counts() doesn't free the memory allocated for
json_loop when there is No such neighbor or address family. This is
fixed now.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-01-21 21:15:23 -08:00
Donald Sharp
11b228cdc4 bgpd: Add afi/safi info to debug processing data
When debugging in bgp is turned on for route-map processing
it would be awful nice to know what afi-safi we are working on
for the particular route-map.  Especially when using a route-map
across different peers and different afi/safi's

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-21 09:14:27 -05:00
Russ White
619a77da10
Merge pull request #7781 from chiragshah6/evpn_dev
[yang,bgpd]  convert neighbor prefix-list and route-map to transactional clis
2021-01-19 11:26:34 -05:00
Russ White
a02d1bbfaa
Merge pull request #7884 from donaldsharp/null_stuff
Null stuff
2021-01-19 07:44:21 -05:00
Russ White
c0b6ef23f7
Merge pull request #7639 from qlyoung/frr-lua
Scripting
2021-01-19 07:17:03 -05:00
Donald Sharp
f6e07e1bdf bgpd: Use uint32_t for size value instead of int in ecommunity struct
The `struct ecommunity` structure is using an int for a size value.
Let's switch it over to a uint32_t for size values since a size
value for data can never be negative.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
5c8ecf6e46 bgpd: attr is already derefed cannot be null here
In the function bgp_adj_out_set_subgroup, the attr pointer
is already derefed in all paths leading to a test for NULL.
You cannot pass a NULL attribute in since the whole function
would just immediately crash.

CID -> 1500604
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-18 09:06:49 -05:00
Donald Sharp
4ec7a71a93 bgpd: Allow peer-groups to have ttl-security hops configured
The command `neighbor PGROUP ttl-security hops X` was being
accepted but ignored.  Allow it to be stored.  I am still
not sure that this is applied correctly, but that is another
problem.

Fixes: #7848
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15 08:29:25 -05:00
Donatas Abraitis
a3dd2d8d9f
Merge pull request #7867 from dewi-morgan/bgp-max-prefix-overflow-clear
bgpd: clear max prefix overflow on de-config
2021-01-15 09:30:56 +02:00
Donald Sharp
2a059a5448 bgpd: Temp fix to allow numbered peers to be part of a peer group
Talking w/ Chirag and he indicated that we can just backout the command
to the original and things would `work` and they do( at least a quick test does )

Put this in place until a proper fix can be done.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-14 15:51:39 -05:00
Dewi Morgan
ac4522e621 bgpd: clear max prefix overflow on de-config
A bgp neighbor remains in Idle state in the event that the number
of received prefixes exceeds the configured maximum prefix for the
neighbor. The neighbor remains in idle state even after de-configuring
the maximum prefix limit for the neighbor.

The fix is to clear the neighbor overflow state if set, after
de-configuring the neighbor maximum-prefix commnd.

This allows the neighbor to establish without having to perform a
clear operation. It also avoids the misleading neigbor summary
indicating that the neighbor is in prefix overflow state (PfxCt)
when no limit is configured for the neighbor.

Signed-off-by: Dewi Morgan <dewi.morgan@intl.att.com>
2021-01-14 14:01:26 +00:00
Donatas Abraitis
6f860c4618
Merge pull request #7748 from adrianomarto/bgp-listen-on-multiple-addresses
BGP daemon listen for connections on multiple addresses
2021-01-13 08:57:38 +02:00
Donald Sharp
484eabb1d7
Merge pull request #7439 from opensourcerouting/bgp-damp-profile2
bgpd: BGP route-flap dampening profiles for peers and peer groups
2021-01-12 11:45:41 -05:00
Russ White
f3c5ce84e2
Merge pull request #7247 from ton31337/feature/enhanced_route_refresh_capability
bgpd: Enhanced Route Refresh capability
2021-01-12 11:27:11 -05:00
Russ White
7fbdb03103
Merge pull request #7670 from ton31337/fix/bgpd_nexhop_handling_for_zebra
bgpd: Handle IPv6 prefixes with IPv4 nexthops for zebra
2021-01-12 07:32:19 -05:00
Donatas Abraitis
b96138fbf0
Merge pull request #7830 from volta-networks/misc_fixes_2021
Misc fixes (bgpd, pathd, tools)
2021-01-11 15:18:18 +02:00
Emanuele Di Pascale
c576dc6a4f bgpd: fix removal of rd vpn export
a missing '!' operator meant that correct rd strings were being
rejected in the destroy callback, making it impossible to remove
once configured.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2021-01-11 10:15:18 +01:00
Emanuele Di Pascale
174c5be33c bgpd: fix unsetting of multipath as-set
in the nortbound callback for the boolean leaf multi-path-as-set, the
actual value of the leaf was being ignored. As a result, going from
as-set to no-as-set was having no effect.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2021-01-11 10:15:18 +01:00
Adriano Marto Reis
85e9cd9aae bgpd: bgpd listening on multiple addresses
Changed bgpd so multiple IP addresses can be specified via -l option.

Signed-off-by: "Adriano Marto Reis" <adrianomarto@gmail.com>
2021-01-11 08:33:18 +00:00
Donatas Abraitis
3de83b7b81
Merge pull request #7810 from imzyxwvu/no-deforig
bgpd: Fix default-originate clearing from peer-groups.
2021-01-11 10:09:41 +02:00
Chirag Shah
c668557533 bgpd: convert nbr rmap transactional cli
- Move vtysh handler to DEFPY
- Convert neighbor route-map command to transactional cli.
- After nb conversion, remove not used apis.
- Implement NB callbacks for afi-safis

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-01-09 23:06:02 -08:00
Chirag Shah
f4eac84c5a yang: nbr plist nb conversion for more afi-safis
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-01-09 23:06:02 -08:00
Chirag Shah
d9986d26c0 bgpd: convert neighbor plist to transactional cli
- Move vtysh handler to DEFPY
- Convert neighbor prefix-list command to transactional cli.
- After nb conversion, remove not used apis.
- implement NB apis for ipv4 afi-safis

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-01-09 23:06:01 -08:00
Donald Sharp
7df0e6bb3b
Merge pull request #7756 from pjdruddy/bgplu-fixes
Bgplu fixes
2021-01-09 15:48:22 -05:00
Donatas Abraitis
07b24afe49 bgpd: Print large-community inside bgp_dump_attr()
Missing large communities.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-09 09:10:21 +02:00
Donald Sharp
d4aa0e7ba4
Merge pull request #7803 from ton31337/fix/validate_community_list
bgpd: Validate community list if they are not malformed
2021-01-08 21:05:32 -05:00
Donatas Abraitis
8b56739eb4 bgpd: Force BGP updates when triggering reset out
When adding/removing some peer's flag we need to make sure we FORCE updates
to avoid suppressing critical updates.

Like entering `no neighbor x.x.x.x send-community large` would suppress
updates by default and another side will have stale large communities.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-08 18:04:18 +02:00
Donald Sharp
257b7b6efc bgpd: Move afi indepedent code outside of checks for it
In bgp_zebra_announce we do work to apply the table map.
This is the same for both v4 and v6 but we have the code
duplicated in both v4 and v6 if statements.  Move outside
to reduce the duplications.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-07 19:24:13 -05:00
Donald Sharp
696ad9ef0e bgpd: Combine two subsuquent if (debug..) statements
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-07 19:04:27 -05:00
Donald Sharp
0b87ad9932 bgpd: Remove redundant checks in bgp_zebra_announce()
BGP has created some redundant checks in bgp_zebra_announce()
Reduce the multiple if statements and consolidate a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-07 18:54:34 -05:00
Donatas Abraitis
acb92e3524
Merge pull request #7749 from wesleycoakley/bgpd-large-community-format-fix
bgpd: reject malformed large-communities
2021-01-07 10:33:59 +02:00
Wesley Coakley
c850908b9d bgpd: separate lcommunity validation from tokenizer
`lcommunity_gettoken` expects a space-delimeted list of 0 or more large
communities. `lcommunity_list_valid` can perform this check.
`lcommunity_list_valid` now validates large community lists more
accurately based on the following condition: Each quantity in a standard bgp
large community must:

1. Contain at least one digit
2. Fit within 4 octets
3. Contain only digits unless the lcommunity is "expanded"
4. Contain a valid regex if the lcommunity is "expanded"

Moreover we validate that each large community list contains exactly 3
such values separated by a single colon each.

One quirk of our validation which is worth documenting is:

```
bgp large-community-list standard test2 permit 1:c:3
bgp large-community-list expanded test1 permit 1:c:3
```

The first line will throw an error complaining about a "malformed community-list
value". The second line will be accepted because the each value is each treated as
a regex when matching large communities, it simply will never match anything so
it's rather useless.

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2021-01-06 07:18:20 -05:00
Donald Sharp
1a3519b69e bgpd: Cleanup debugs for bgp_zebra_route_notify_owner
User %pRN as well as add some more debugs for other
interesting cases.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-05 15:37:33 -05:00
Donald Sharp
92269aa253 bgpd: Allow more detailed knowledge of bgp's internal state
When bgp is using wait for install semantics it would be nice
to be able to debug it when it is running.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-05 15:37:33 -05:00
Donatas Abraitis
bcbeb3f967 bgpd: Use neighbor_events instead of debug_update for route-refresh msg
This was somewhy under bgp_debug_udpate() guard and others are under
bgp_debug_neighbor_events().

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-05 20:19:42 +02:00
Donatas Abraitis
9af52ccf81 bgpd: Implement enhanced route refresh capability
16:40:49 BGP: 192.168.0.2: sending route-refresh (BoRR) for IPv4/unicast
16:40:51 BGP: 192.168.0.2: sending route-refresh (EoRR) for IPv4/unicast

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-05 20:19:41 +02:00
Russ White
ee117a8bd6
Merge pull request #7507 from ton31337/fix/bgpd_do_not_send_update_if_path_really_did_not_change
bgpd: Do not send BGP UPDATE if the route actually not changed
2021-01-05 10:26:18 -05:00
Patrick Ruddy
b567ed7eeb
Merge pull request #7722 from AnuradhaKaruppiah/mh-fixes
bgpd, zebra: evpn mh fixes
2021-01-05 09:26:17 +00:00
Donatas Abraitis
0e8916e0cf bgpd: Validate community list if they are not malformed
Before fix:
```
root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535:429496723296'
root@exit1-debian-9:~/frr#

root@exit1-debian-9:~/frr# vtysh -c 'c' -c 'bgp community-list standard test permit 65535:4294967296'
root@exit1-debian-9:~/frr#

root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535'
root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535:'
% Malformed communities attribute
```

After fix:
```
root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535:4294967296'
% Malformed communities attribute

root@exit1-debian-9:~/frr# vtysh -c 'c' -c 'bgp community-list standard test permit 65535:4294967299'
% Malformed community-list value

root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535:'
% Malformed communities attribute
root@exit1-debian-9:~/frr# /usr/local/bin/vtysh  -c 'c' -c 'route-map test permit 10' -c 'set community 65535'
% Malformed communities attribute
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-05 10:59:11 +02:00
zyxwvu Shi
66de968020 bgpd: Fix default-originate clearing from peer-groups.
Fix `peer_default_originate_unset` so default route can be withdrawn
when `default-originate` option is being unset from a peer-group.

The loop calling `bgp_default_originate` is clearing default-originate
from the peer-group peer `peer` instead of the peer-group member peer
`member`.

Signed-off-by: zyxwvu Shi <shiyuchen.syc@bytedance.com>
2021-01-05 07:17:48 +00:00
Pat Ruddy
3466e2a1ea bgpd: fix zclient return code damage in labelpool
The check for the return code for zclient_send_get_label_chunk is
reversed and therefore the pending count does not get incremented
for each successful label chunk request.
This has the effect of requesting a 50 label chunk per label request
from BGP i.e we request 50 times the labels we require.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-01-04 14:29:44 +00:00
Pat Ruddy
78b351ddcd bgpd: release label to labelpool on dereg
when we de-register for a label associated with a prefix then release
it back to the labelpool to clean up the stale reference held in the
ledger and inuse lists.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-01-04 14:29:44 +00:00
Pat Ruddy
992dd67ec7 bgpd: refactor label allocation code
To prepare for fixing an issue where labels do not get released back
to the labelpool when the route is deleted some refactoring is
necessary. There are 2 parts to this.
1. restructure the code to remove the circular nature of label
allocations via the labelpool and decouple the label type decision
from the notification fo the FEC.
The code to notify the FEC association to zebra has been split out
into a separate function so that it can be called from the synchronous
path (for registration of index-based labels and de-registration of all
labels), and from the asynchronous path where we need to wait for a
callback from the labelpool code with a label allocation.
The decision about whether we are using an index-based label or an
allocated label is reflected in the state of the BGP_NODE_LABEL_REQUESTED
flag so the checks on the path_info in the labelpool callback code are
no longer required.
2. change the owned of a labelpool allocated label from the path info
structure to the bgp_dest structure. This allows labels to be released
(in a subsequent commit) when the owner (bgp_dest) goes away.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-01-04 14:29:44 +00:00
Pat Ruddy
331bd0ebad bgpd: add missing unlock of path_info
when the path info information is queued on the work queue it
is protected by a lock to avoid the rug being pulled whilst it
resides on the queue add an unlock in the error case where we do
no queue the reference to the workqueue.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-01-04 14:29:44 +00:00
Pat Ruddy
e3ea65039e bgpd: add show commands for bgp labelpool
These commands allow the bgp labelpool lists and counts to be
viewed for debug purposes.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-01-04 14:29:35 +00:00
Donald Sharp
e80bc08944 bgpd: Prevent null deref
There exists a path where we could possibly have a NULL deref
of a pointer.  Prevent this from happening.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-04 07:56:47 -05:00
Anuradha Karuppiah
6c111b51a1 bgpd: add missing type-1 and type-4 route descriptions to the legend
Sample output -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# net show bgp l2vpn evpn route rd 27.0.0.16:3
EVPN type-1 prefix: [1]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]

BGP routing table entry for 27.0.0.16:3:[1]:[0]:[03:44:38:39:ff:ff:01:00:00:01]:[32]:[0.0.0.0]
Paths: (4 available, best #2)
  Advertised to non peer-group peers:
  spine-1(swp1) spine-1(swp2) spine-2(swp3) spine-2(swp4)
  4435 5551
    27.0.0.16 from spine-1(swp2) (27.0.0.13)
      Origin IGP, valid, external
      Extended Community: RT:5551:1009 ET:8
      Last update: Thu Sep  3 21:01:53 2020
  4435 5551
    27.0.0.16 from spine-1(swp1) (27.0.0.13)
      Origin IGP, valid, external, bestpath-from-AS 4435, best (Router ID)
      Extended Community: RT:5551:1009 ET:8
      Last update: Thu Sep  3 21:01:53 2020
  4435 5551
    27.0.0.16 from spine-2(swp3) (27.0.0.14)
      Origin IGP, valid, external
      Extended Community: RT:5551:1009 ET:8
      Last update: Thu Sep  3 21:01:53 2020
  4435 5551
    27.0.0.16 from spine-2(swp4) (27.0.0.14)
      Origin IGP, valid, external
      Extended Community: RT:5551:1009 ET:8
      Last update: Thu Sep  3 21:01:53 2020

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
b37ff319f3 bgpd: fix typo "show bgp l2vpn evpn es-evi [vni] <> json" display
The ead-per-evi flag was being displayed as ed-per-evi.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
2eef4f20d0 bgpd: rename some MH functions and take care of deffered logs etc.
Rename VTEP change functions for better readability, improve comments
and add missing logs.

No functional change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:40:07 -08:00