Commit Graph

36576 Commits

Author SHA1 Message Date
Donald Sharp
9bc0cd8241 zebra: Prevent accidental re memory leak in odd case
There exists a path in rib_add_multipath where if a decision
is made to not use the passed in re, we just drop the memory
instead of freeing it.  Let's free it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-27 06:25:34 -04:00
Donald Sharp
d528c02a20 zebra: Handle kernel routes appropriately
Current code intentionally ignores kernel routes.  Modify
zebra to allow these routes to be read in on linux.  Also
modify zebra to look to see if a route should be treated
as a connected and mark it as such.

Additionally this should properly handle some of the issues
being seen with NOPREFIXROUTE.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-27 06:25:34 -04:00
Donald Sharp
bdfccf69fa zebra: Expose rib_update_handle_vrf_all
This function will be used on interface down
events to allow for kernel routes to be cleaned
up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-27 06:25:34 -04:00
Donald Sharp
f450e1cda4 zebra: Make p and src_p const for rib_delete
The prefix'es p and src_p are not const.  Let's make
them so.  Useful to signal that we will not change this
data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-27 06:25:34 -04:00
Donatas Abraitis
7a461479a0 bgpd: Respect BLACKHOLE community for internal BGP peering also
rfc7999 does not define to use this technique ONLY for EBGP sessions.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-27 10:08:54 +03:00
Donald Sharp
52f292d188
Merge pull request #16657 from Jafaral/ospfv3_test_fix
tests: Fix frequent ospfv3 basic functionality test failure
2024-08-26 20:29:38 -04:00
Jafar Al-Gharaibeh
0d745741c9 tests: Fix frequent ospfv3 basic functionality test failure
The dead timer is set to 4 seconds, while the hello interval is set to 6535.
This test will only pass of the platform is fast enough for ospfv3 to
converge in 4 seconds. These timers were already tested multiple time earlier.
This test should just make sure that the boundary value 65535 is configurable,

Other changes in this commit:
  - add sequence numbers to the dead intervals tests to make it easier to
    track test faliures.
  - swap the config order in one test to match order with all other tests.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-08-26 16:35:37 -05:00
Donald Sharp
3c4ffcacfe tests: Allow convergence before adding multicast routes
Current code adds a new vlan interface, sets up ospf and
pim on it and immediately starts shoving data down the pipes.
This of course has the fun thing where the IGP and pim do not
always come up in a nice neat manner and the test is looking
for state from a nice neat come up, even though pim is `working`
correctly it is not correct for what the test wants.

Modify the code to ensure that ospf is up and has propagated
the route where it is needed as well as that pim neighbors have
properly come up, then initiate the multicast streams and igmp
reports.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-26 16:02:46 -04:00
Louis Scalbert
a152692f5a bgpd: fix labels static-analyser
Fix static-analyser warnings with BGP labels:

> $ scan-build make -j12
> bgpd/bgp_updgrp_packet.c:819:10: warning: Access to field 'extra' results in a dereference of a null pointer (loaded from variable 'path') [core.NullDereference]
>                                                 ? &path->extra->labels->label[0]
>                                                    ^~~~~~~~~

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-26 10:29:12 +02:00
Donatas Abraitis
d84cae2db7 bgpd: Set encap attribute if received and parsed
It's not used much in the code, but we should have it set when everything is fine.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-25 19:15:10 +03:00
Donatas Abraitis
b713df85bd bgpd: Allow filtering Encap attribute
Filtering this attribute via `path-attribute discard/treat-as-widthraw`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-25 19:11:01 +03:00
Donatas Abraitis
f0bb2626ef bgpd: Allow filtering PMSI Tunnel attribute
Filtering this attribute via `path-attribute discard/treat-as-widthraw`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-25 19:05:53 +03:00
Donatas Abraitis
f390253ca7 bgpd: Allow filtering Prefix-SID attribute
Filtering this attribute via `path-attribute discard/treat-as-widthraw`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-25 19:03:05 +03:00
Donald Sharp
f85dfb3f1a
Merge pull request #16649 from opensourcerouting/fix/free_memory_on_return
bgpd: Free epvn_overlay memory on error
2024-08-24 15:30:45 -04:00
Donatas Abraitis
5eb80edf97 bgpd: Free epvn_overlay memory on error
When parsing EVPN NLRIs, and an error occurred, do no forget to free the memory.

Fixes: 4ace11d010 ("bgpd: Move evpn_overlay to a pointer")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-24 11:58:48 +03:00
Donatas Abraitis
ab2fd988c9
Merge pull request #16646 from csilt/pim-ifp-crash
pimd: Fix crash in pimd
2024-08-24 11:12:23 +03:00
Donatas Abraitis
8d4c70697b
Merge pull request #16631 from pguibert6WIND/imported_from_l3nhg_json
bgpd: add json support for BGP L3NHG values
2024-08-24 09:32:49 +03:00
Corey Siltala
12a783d313 pimd: Fix crash in pimd
ifp->info is not always set in PIM. So add a guard here to stop
it from crashing when addresses are added to a non-PIM enabled interface
and PIM zebra debugging is enabled.

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
2024-08-23 15:42:03 -05:00
Mark Stapp
b4dae97381
Merge pull request #16609 from donaldsharp/singleton_no_weight
Reduce the number of Singleton objects when using weight for NHG's
2024-08-23 16:19:29 -04:00
Donatas Abraitis
7af65715fc
Merge pull request #16640 from louis-6wind/fix-nhrp-local
nhrpd: fix sending /32 shortcut
2024-08-23 22:57:09 +03:00
Donald Sharp
a04cca6f74
Merge pull request #16633 from Jafaral/fix-version-build
config: fix missing case when reporting version 'configured with'
2024-08-23 14:45:33 -04:00
Louis Scalbert
af54901405 nhrpd: fix sending /32 shortcut
The remote spoke always sends a 32 prefix length to a shortcut request.
In the example, the remote spoke as the IP address 192.168.2.1/24.

spoke1# sh ip nhrp shortcut
Type     Prefix                   Via                      Identity
dynamic  192.168.2.1/32           10.255.255.2

Do not deal with local routes in nhrpd. Now:

spoke1# sh ip nhrp shortcut
Type     Prefix                   Via                      Identity
dynamic  192.168.2.0/24           10.255.255.2

Fixes: d4aa24ba7d ("*: Introduce Local Host Routes to FRR")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-23 17:34:13 +02:00
Philippe Guibert
3c2273178d bgpd: add json support for BGP L3NHG values
Some json attributes are missing for L3NHG values.

> PE1# show bgp vrf all detail
> [..]
> Instance vrf-purple:
> BGP table version is 1, local router ID is 27.3.0.85, vrf id 7
> Default local pref 100, local AS 65000
> BGP routing table entry for fe80::4620:ff:feff:ff01/128, version 1
> Paths: (1 available, best #1, vrf vrf-purple)
>   Not advertised to any peer
>   Imported from 10.30.30.30:5:[2]:[0]:[48]:[44:20:00:ff:ff:01]:[128]:[fe80::4620:ff:feff:ff01], VNI 4000  Local
>     ::ffff:a1e:1e1e (metric 20) from 10.30.30.30 (10.30.30.30) announce-nh-self
>       Origin IGP, localpref 100, valid, internal, best (First path received)
>       Extended Community: RT:65000:4000 ET:8
>       Last update: Thu Aug 22 18:23:38 2024
>
> Displayed 1 routes and 1 total paths

> PE1# show bgp vrf all json detail
> {
> "vrf-purple":{
>  "vrfId": 7,
>  "vrfName": "vrf-purple",
>  "tableVersion": 1,
>  "routerId": "27.3.0.85",
>  "defaultLocPrf": 100,
>  "localAS": 65000,
>  "routes": { "fe80::4620:ff:feff:ff01/128": [{"importedFrom":"10.30.30.30:5","l3nhg":false,"l3nhgActive":false, "vni": "4000",
> "aspath":{"string":"Local","segments":[],"length":0},"announceNexthopSelf":true,"origin":"IGP","locPrf":100,
> "valid":true,"version":1,"bestpath":{"overall":true,"selectionReason":"First path received"},
> "extendedCommunity":{"string":"RT:65000:4000 ET:8"},"lastUpdate":{"epoch":1724343817,
> "string":"Thu Aug 22 18:23:37 2024\n"},
> "nexthops":[{"ip":"::ffff:a1e:1e1e","hostname":"PE2","afi":"ipv6",
> "scope":"global","metric":20,"accessible":true,"used":true}],
> "peer":{"peerId":"10.30.30.30","routerId":"10.30.30.30","hostname":"PE2","type":"internal"}}]
>  }  }
> }

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-08-23 10:37:51 +02:00
Jafar Al-Gharaibeh
83a60e7e20
Merge pull request #15561 from kraj/master
Mimic GNU basename() API for non-glibc library e.g. musl
2024-08-23 00:34:00 -04:00
Jafar Al-Gharaibeh
8f6c7c39e7
Merge pull request #16632 from donaldsharp/SA_warnings_from_upstream
Sa warnings from upstream
2024-08-22 18:25:11 -04:00
Donald Sharp
3d8ccdb115
Merge pull request #16615 from Jafaral/revert-v4-v6-bgp
Revert ipv4-mapped ipv6 and 6vpe nexthop in BGP
2024-08-22 17:57:38 -04:00
Khem Raj
0ef71391f0
zebra: Mimic GNU basename() API for non-glibc library e.g. musl
musl only provides POSIX version of basename and it has also removed
providing it via string.h header [1] which now results in compile errors
with newer compilers e.g. clang-18

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2024-08-22 14:50:41 -07:00
Jafar Al-Gharaibeh
4b050cb080 config: fix missing case when reporting version 'configured with'
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-08-22 14:28:49 -05:00
Mark Stapp
44e8a958b0
Merge pull request #16630 from donaldsharp/babel_metric
Babel metric
2024-08-22 15:20:32 -04:00
Jafar Al-Gharaibeh
b3dc3680bc tools, ospfclient: add a config option to skip installing python scripts
The new config option --disable-python-runtime allows make install to proceed
without installing any of the python scripts. When installing from deb/rpm
packages those are bundled as frr-pythontools, which is independent from the
frr binaries and can already be skipped. I.e, this PR gives the option to skip
those scripts when building/installing from sources too.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-08-22 13:46:30 -05:00
Donald Sharp
286e6f8871 lib: Ensure SA that root cannot be NULL
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:53:47 -04:00
Donald Sharp
4344ac1d28 bgpd: global_gr_mode does not need to be set twice
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:32:20 -04:00
Donald Sharp
c20fa972d6 zebra: Create Singleton nhg's without weights
Currently FRR when it has two nexthop groups:
A
  nexthop 1 weight 5
  nexthop 2 weight 6
  nexthop 3 weight 7
B
  nexthop 1 weight 3
  nexthop 2 weight 4
  nexthop 3 weight 5

We end up with 5 singleton nexthops and two groups:

ID: 181818168 (sharp)
     RefCnt: 1
     Uptime: 00:04:52
     VRF: default
     Valid, Installed
     Depends: (69) (70) (71)
           via 192.168.119.1, enp13s0 (vrf default), weight 182
           via 192.168.119.2, enp13s0 (vrf default), weight 218
           via 192.168.119.3, enp13s0 (vrf default), weight 255
ID: 181818169 (sharp)
     RefCnt: 1
     Uptime: 00:02:08
     VRF: default
     Valid, Installed
     Depends: (71) (127) (128)
           via 192.168.119.1, enp13s0 (vrf default), weight 127
           via 192.168.119.2, enp13s0 (vrf default), weight 170
           via 192.168.119.3, enp13s0 (vrf default), weight 255

id 69 via 192.168.119.1 dev enp13s0 scope link proto 194
id 70 via 192.168.119.2 dev enp13s0 scope link proto 194
id 71 via 192.168.119.3 dev enp13s0 scope link proto 194
id 127 via 192.168.119.1 dev enp13s0 scope link proto 194
id 128 via 192.168.119.2 dev enp13s0 scope link proto 194
id 181818168 group 69,182/70,218/71,255 proto 194
id 181818169 group 71,255/127,127/128,170 proto 194

This is not a desirable state to be in.  If you have a
link flapping in the network and weights are changing
rapidly you end up with a large number of singleton
nexthops that are being used by the nexthop groups.
This fills up asic space and clutters the table.
Additionally singleton nexthops cannot have any weight
and the fact that you attempt to create a singleton
nexthop with different weights means nothing to the
linux kernel( or any asic dplane ).  Let's modify
the code to always create the singleton nexthops
without a weight and then just creating the
NHG's that use the singletons with the appropriate
weight.

ID: 181818168 (sharp)
     RefCnt: 1
     Uptime: 00:00:32
     VRF: default
     Valid, Installed
     Depends: (22) (24) (28)
           via 192.168.119.1, enp13s0 (vrf default), weight 182
           via 192.168.119.2, enp13s0 (vrf default), weight 218
           via 192.168.119.3, enp13s0 (vrf default), weight 255
ID: 181818169 (sharp)
     RefCnt: 1
     Uptime: 00:00:14
     VRF: default
     Valid, Installed
     Depends: (22) (24) (28)
           via 192.168.119.1, enp13s0 (vrf default), weight 153
           via 192.168.119.2, enp13s0 (vrf default), weight 204
           via 192.168.119.3, enp13s0 (vrf default), weight 255

id 22 via 192.168.119.1 dev enp13s0 scope link proto 194
id 24 via 192.168.119.2 dev enp13s0 scope link proto 194
id 28 via 192.168.119.3 dev enp13s0 scope link proto 194
id 181818168 group 22,182/24,218/28,255 proto 194
id 181818169 group 22,153/24,204/28,255 proto 194

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:22:06 -04:00
Donald Sharp
b8e24a0ad0 lib, zebra: Modify nexthop_cmp to allow you to use weight or not
Currently nexthop weight is a discriminator on whether or not
a nexthop matches.  There is a need to no use the weight as
part of this comparison function so let's add a boolean to
allow us to say use this or not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:22:06 -04:00
Jafar Al-Gharaibeh
741c030395 Revert "Merge pull request #15368 from louis-6wind/fix-6pe"
This reverts commit df98e88368, reversing
changes made to b652119235.
2024-08-22 10:38:09 -05:00
Donald Sharp
05c17eff06
Merge pull request #16450 from nabahr/static_joins
PIM: Implement static IGMP joins without an IGMP report
2024-08-22 11:32:56 -04:00
Jafar Al-Gharaibeh
879460ce27
Merge pull request #16613 from donaldsharp/weight_issues
Weight issues
2024-08-22 11:19:54 -04:00
Jafar Al-Gharaibeh
db71bebc2a
Merge pull request #16620 from LabNConsulting/new-munet-0-14-10
tests: update munet to 0.14.10
2024-08-22 11:14:18 -04:00
Donald Sharp
63e2c092a3 babeld: Do not remove route when replacing
When sending down a babel route do not remove then
add it back.  Just send down the change.  This
change will not cause packets to be dropped now.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 10:24:42 -04:00
Donald Sharp
b4c88abe9f babeld: Send the route's metric down to zebra.
Babel was thinking it was talking to the kernel for
route installation instead of zebra.  Pass down the
metric instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 10:22:58 -04:00
Donatas Abraitis
18e2d0d1a9
Merge pull request #16621 from LabNConsulting/fix-grpc-client
tests: dont print sys.path when running grpc-query.py
2024-08-22 09:41:34 +02:00
Donatas Abraitis
0db604568c
Merge pull request #16546 from dmytroshytyi-6WIND/fix_bgp_open_notification_snmp
bgpd: fix, do not access peer->notify.data when it is null
2024-08-22 07:18:23 +02:00
Jafar Al-Gharaibeh
72dfd5a6bf
Merge pull request #16619 from qlyoung/fix-rtd-build-sphinx-environment-injection
doc: update sphinx configs for RTD changes
2024-08-22 00:05:24 -04:00
Christian Hopps
436e4d9755 tests: dont print sys.path when running grpc-query.py
Don't print the sys.path when running grpc-query.py. Doing so
was causing tests to fail.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-08-21 22:07:25 -04:00
Christian Hopps
cff1103843 tests: update munet to 0.14.10
Changes:

- mutini: handle possible missed zombie cleanup leading to test hangs
- mutini: also we avoid logging in the signal handler which was causing
  an exception.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-08-21 21:05:48 -04:00
Quentin Young
95d9bf12e3 doc: update sphinx configs for RTD changes
Read The Docs made some changes that require us to add some
configuration in our build config files.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2024-08-21 19:38:51 -04:00
Donatas Abraitis
5989d1cf78
Merge pull request #16608 from louis-6wind/fix-no-rpki
bgpd: fix crash at no rpki
2024-08-21 22:12:05 +02:00
Jafar Al-Gharaibeh
0097489b4a Revert "Merge pull request #15614 from louis-6wind/fix-6pe-address"
This reverts commit b3600d82dc, reversing
changes made to 51119823d0.
2024-08-21 13:37:43 -05:00
Jafar Al-Gharaibeh
0d2d20825e Revert "Merge pull request #16439 from louis-6wind/fix-ipv4-mapped-ipv6"
This reverts commit cc0fdd3b1d, reversing
changes made to 4e208087fd.
2024-08-21 13:26:50 -05:00
Donald Sharp
b62de7de2e zebra, tests: Connected and Local routes should have a weight of 1
All routes received by zebra from upper level protocols have a weight
of 1.  Let's just make everything extremely consistent in our code.
Lot's of tests needed to be fixed up to make this work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-21 10:17:47 -04:00