Commit Graph

5829 Commits

Author SHA1 Message Date
Donald Sharp
9f002fa5dd bgpd: Fix import check removal
Fix: 06e4e90132

Modified BGP to pay more attention the prefix returned from
zebra to ensure that a LPM wasn't accidently causing BGP
import checks to think it had a match when it did not.
This unfortunately removed the check to handle the route
removal.

This sequence of config and events would leave BGP in a bad state:
ip route 100.100.100.0/24 Null0
router bgp 32932
  bgp network import-check
  address-family ipv4 uni
    network 100.100.100.0/24

Then if you removed the static route the import check would
still think the route existed:

donatas-pc(config)# ip route 100.100.100.0/24 Null0

donatas-pc(config)# do sh ip bgp import-check-table
Current BGP import check cache:
 100.100.100.0 valid [IGP metric 0], #paths 1
  blackhole
  Last update: Sat Apr 23 22:51:34 2022

donatas-pc(config)# do sh ip nht
100.100.100.0
 resolved via static
 is directly connected, Null0
 Client list: bgp(fd 17)

donatas-pc(config)# do sh ip bgp neighbors 192.168.10.123 advertised-routes | include 100.100.100.0
*> 100.100.100.0/24 0.0.0.0                  0         32768 i

donatas-pc(config)# no ip route 100.100.100.0/24 Null0

donatas-pc(config)# do sh ip nht
100.100.100.0
 resolved via kernel
 via 192.168.10.1, enp3s0
 Client list: bgp(fd 17)

donatas-pc(config)# do sh ip bgp import-check-table
Current BGP import check cache:
 100.100.100.0 valid [IGP metric 0], #paths 1
  blackhole
  Last update: Sat Apr 23 22:51:34 2022

donatas-pc(config)# do sh ip bgp neighbors 192.168.10.123 advertised-routes | include 100.100.100.0
*> 100.100.100.0/24 0.0.0.0                  0         32768 i
donatas-pc(config)#

Fix this by moving the code to handle the prefix check to the
evaluation function and mark the bnc as not matching and actually
evaluate the bnc.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-24 17:08:12 -04:00
Donald Sharp
a71e190d44
Merge pull request #10961 from opensourcerouting/build-ms-ext
build: enable `-fms-extensions`
2022-04-20 07:51:45 -04:00
Donatas Abraitis
3d3c38b1d4
Merge pull request #11051 from donaldsharp/speell_more
Speell more
2022-04-20 11:04:14 +03:00
Russ White
a037a34436
Merge pull request #10977 from bobuhiro11/alloc_sid_based_on_prefix
bgpd: take SRv6 locator's prefix length into account when generating SIDs
2022-04-19 11:17:57 -04:00
Donatas Abraitis
db8d184392
Merge pull request #11040 from donaldsharp/bgp_type5_route_handling
bgpd: Allow type 5 routes to be handled better when link is flapping
2022-04-19 17:35:22 +03:00
Donald Sharp
4667220e3a *: Fix spelling of accidently
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:31:30 -04:00
Donald Sharp
2ef62909a9 *: Fix spelling of atleast
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:25:03 -04:00
Donald Sharp
544be97911 *: Fix spelling of strucutre
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:19:37 -04:00
Donald Sharp
ce5002c659 *: Fix spelling of comparision
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:18:43 -04:00
Donald Sharp
8afb9d8a70 *: Fix spelling of seperator
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:15:23 -04:00
Donatas Abraitis
f5327fc339
Merge pull request #11012 from anlancs/bgpd-mh-simplify-condition
zebra: simplify one check for evpn-mh
2022-04-19 13:04:43 +03:00
Jafar Al-Gharaibeh
4079cda2e6
Merge pull request #11032 from anlancs/fix/bgpd-evpn-mh-null-debug
bgpd: fix NULL deference in evpn-mh's log
2022-04-18 22:42:03 -05:00
Donald Sharp
7f2e9cce7f bgpd: Allow type 5 routes to be handled better when link is flapping
In some stress testing, we are seeing type-5 evpn routes being
left in a rejected state in zebra.

Sequence of events as I am seeing it:

a) Interface comes up that type5 routes nexthop depends on
b) zebra processes creates the connected and lets bgp know via nht
c) bgp installs the route to zebra
d) zebra processes and sends install to kernel
e) before route is installed, the interface the nexthop points at flaps
f) the route install is rejected, notify zebra
g) the interface comes up
h) zebra gets the notification about the route install rejection
i) zebra processes the down/up and turns it into a single up event
j) BGP never reinstalls the type 5 route

This up event does not translate into a nexthop tracking event
when the events happen quickly enough and/or zebra is extremelyh
busy and bgp would never see that the nexthops changed even very quickly.

This is the same thing that was going on with
https://github.com/FRRouting/frr/pull/7724
in PBR.

To fix this let's notice the interface up/down events for v4
in bgp now as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-18 14:15:23 -04:00
Russ White
eb3bd82451
Merge pull request #11028 from ton31337/fix/pass_non_transitive_communities_via_rsclient
bgpd: Pass non-transitive ext-communities between Route Server and RS clients
2022-04-15 16:04:04 -04:00
anlan_cs
46281b21af bgpd: fix NULL deference in evpn-mh's log
Fix NULL deference issue in log. And change one word - "vtep",
it should be with lowercase letters like other places.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-14 11:10:32 -04:00
Nobuhiro MIKI
9fa4ae2943 bgpd: take SRv6 locator's prefix length into account when generating SIDs
Until now, it has been hard-coded that the position at which the label
is inserted is from the 64th bits. Therefore, when the Locator prefix
was not /64, incorrect SIDs were generated. Also, SIDs are generated
in duplicate on Lines 604 & 613 in bgpd/bgp_mplsvpn.c.

In this patch, the position where the label is inserted is calculated
based on the sum of block_bits_length and node_bits_length (i.e., the
user-specified Locator prefix length). In addition, SID generation is
performed at one location in alloc_new_sid.

Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2022-04-14 14:37:55 +09:00
Donatas Abraitis
b17d5444f4 bgpd: Pass non-transitive ext-communities between Route Server and RS clients
https://datatracker.ietf.org/doc/html/rfc7947#section-2.2

Optional recognized and unrecognized BGP attributes,
   whether transitive or non-transitive, SHOULD NOT be updated by the
   route server (unless enforced by local IXP operator configuration)
   and SHOULD be passed on to other route server clients.

By default LB ext-community works with iBGP peers. When we receive a route
from eBGP peer, we can send LB ext-community to iBGP peers.

With this patch, allow sending LB ext-community to iBGP/eBGP peers if they
are set as RS clients.

FRR does not send non-transitive ext-communities to eBGP peers, but for
example GoBGP sends and if it's set as RS client, we should pass those attributes
towards another RS client.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-14 08:36:20 +03:00
Nobuhiro MIKI
808ad1b617 bgpd: fix memory leak
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2022-04-14 10:07:22 +09:00
Russ White
0d523362d6
Merge pull request #10978 from anlancs/bgpd-cleanup-6
bgpd: cosmetic change for evpn-mh
2022-04-13 15:27:39 -04:00
Russ White
bd751c0700
Merge pull request #10987 from opensourcerouting/fix/bgp_conditional_advertisements_rmap_change_peer_groups
bgpd: Do not forget to update conditional advertisements rmaps for peer-groups
2022-04-13 15:00:14 -04:00
Russ White
8a86917097
Merge pull request #11024 from anlancs/bgpd-fix-missing-newline
bgpd: fix wrong check for default VRF
2022-04-13 14:56:00 -04:00
Russ White
5dd323579a
Merge pull request #11025 from anlancs/bgpd-remove-l3nhg-control
bgpd: remove unnecessary l3nhg knob for evpn-mh
2022-04-13 14:55:29 -04:00
Russ White
6a1dbeba2f
Merge pull request #11010 from opensourcerouting/feature/reuse_bgp_attr_set_community_for_flags
bgpd: Reuse bgp_attr_set_[el]community() for setting attribute flags
2022-04-13 14:54:30 -04:00
Russ White
a39df8492d
Merge pull request #11009 from opensourcerouting/fix/med_for_aggregate-address
bgpd: aggregate-address fixes
2022-04-13 14:53:14 -04:00
Russ White
7c6316c521
Merge pull request #11013 from opensourcerouting/fix/convert_bgp_peer_sort_t_to_enum
bgpd: typedef enum to enum
2022-04-13 14:52:58 -04:00
Donatas Abraitis
cd876f8a78
Merge pull request #10935 from anlancs/zebra-mh-esi-warning
zebra: adjust the warnings for ESI of evpn-mh
2022-04-13 15:45:07 +03:00
anlan_cs
c2b7d418f7 bgpd: remove unnecessary l3nhg knob for evpn-mh
Remove unnecessary `install_l3nhg` knob because it has already
been controlled by the command: "[no$no] use-es-l3nhg".

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-13 05:17:08 -04:00
anlan_cs
4a5271a56b bgpd: fix wrong check for default VRF
Currently the warning is wrong:
```
root#show bgp vrf default vni
BGP instance for VRF default not foundACC1(config)#
```

Two changes for "show bgp vrf VRFNAME vni [json]":
- Correct the default VRF check
- Add newline for warning

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-13 05:00:33 -04:00
Abhinay Ramesh
f78cfba9c9 bgpd: Metric not set with default route.
Description:
- When default route is originated using the
  neighbor default-originate command, MED is
  not set as part of the update message
  attribute.

- Changes are done to set the MED value and MED
  flag for default route.

Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2022-04-12 19:55:54 -07:00
Donatas Abraitis
682abee174 bgpd: Apply frrbot styling
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:15:17 +03:00
Donatas Abraitis
e8e36ff315 bgpd: Convert bpacket_attr_vec_type to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Donatas Abraitis
79288e4c12 bgpd: Convert bgp_attr_parse_ret_t to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Donatas Abraitis
9c2fd3fe44 bgpd: Convert vpn_policy_direction_t to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Donatas Abraitis
d54f55f22d bgpd: Convert bgp_policy_type_e to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Donatas Abraitis
3061acc235 bgpd: Convert bgp_peer_sort_t to enum
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:13:55 +03:00
Donatas Abraitis
26870e2dcc bgpd: Fix styling, drop braces for single statement block
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:12:16 +03:00
Donatas Abraitis
58cf5c088a bgpd: Reuse bgp_attr_set_ecommunity() for setting attribute flags
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:09:28 +03:00
Donatas Abraitis
9d34440bf8 bgpd: Reuse bgp_attr_set_[l]community() for setting attribute flags
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-12 22:09:28 +03:00
Russ White
695c24c3b0
Merge pull request #10994 from opensourcerouting/fix/autocomplete_for_advertise_map
bgpd: Use autocomplete for route-map under conditional advertisements CLI
2022-04-12 14:40:33 -04:00
Russ White
94ee557658
Merge pull request #10999 from opensourcerouting/fix/bgp_aliases_with_community
bgpd: Allow setting BGP [large]community in route-maps
2022-04-12 14:37:58 -04:00
Mark Stapp
946fb036a3
Merge pull request #11000 from opensourcerouting/feature/show_conditional_adv_timer_in_neighbor_cli
bgpd: Show conditional advertisement timers in neighbor CLI output
2022-04-12 11:54:16 -04:00
anlan_cs
fff7545a03 bgpd: correct a few comments for evpn-mh
Correct a few evpn-mh omissions mainly on type-1 and type-4.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-12 09:33:06 -04:00
Donatas Abraitis
764402feba bgpd: Fix styling for aggregate_addressv4_cmd
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-11 17:53:42 +03:00
Donatas Abraitis
cacba915d0 bgpd: Add autocomplete for aggregate-address ... route-map X
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-11 17:47:52 +03:00
Donatas Abraitis
59136db5a7 bgpd: Send MED attribute when aggregate prefix is created
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-11 17:46:04 +03:00
anlan_cs
b3ba21181a bgpd: correct one flag name on comment for evpn-mh
Correct flag name of `attr.es_flags` - ATTR_ES_L3_NHG_USE.

"bgp_path_info"s (Per "es-vrf") with this flag can use l3nhg.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-10 19:39:19 +08:00
Donatas Abraitis
6e37924b05 bgpd: Show conditional advertisement timers in neighbor CLI output
```
spine1-debian-11# sh ip bgp neighbors 192.168.0.1
BGP neighbor is 192.168.0.1, remote AS 65001, local AS 65000, external link
Hostname: exit1-debian-11
  BGP version 4, remote router ID 192.168.10.123, local router ID 192.168.100.1
  BGP state = Established, up for 00:00:32
  Last read 00:00:30, Last write 00:00:30
  Hold time is 180, keepalive interval is 60 seconds
  Configured conditional advertisements interval is 5 seconds
  Time until conditional advertisements begin is 4 seconds
```

```
    "bgpTimerConfiguredConditionalAdvertisementsSec":5,
    "bgpTimerUntilConditionalAdvertisementsSec":1,
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-09 18:12:36 +03:00
Donatas Abraitis
c0945b7828 bgpd: Allow setting BGP [large]community in route-maps
Before:
```
spine1-debian-11(config-route-map)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
% Malformed communities attribute
```

After:
```
spine1-debian-11(config)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
spine1-debian-11(config-route-map)#
```

Same for large-communities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-09 17:34:06 +03:00
Donatas Abraitis
9118301e48 bgpd: Do not forget to update conditional advertisements rmaps for peer-groups
When the peer is configured for the first time:
```
neighbor P1 peer-group
neighbor P1 remote-as external
neighbor P1 advertise-map ADV exist-map EXIST
neighbor 10.10.10.1 peer-group P1
```

Conditional advertisements route-maps are not updated and cond. advertisements
do not work until FRR restarted. BGP sessions clear does not help.

Or even changing peer-group for a peer, causes this bug to kick in.

```
no neighbor 10.10.10.1
neighbor 10.10.10.1 peer-group P2
```

With this fix, cond. advertisements start working immediatelly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-08 22:43:01 +03:00
Donatas Abraitis
3ccddc2566 bgpd: Use autocomplete for route-map under conditional advertisements CLI
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-08 16:54:22 +03:00