Commit Graph

38290 Commits

Author SHA1 Message Date
Donald Sharp
348c2dc3f8 bgpd: Only update peer connection information when needed
Currently bgp is repeatedly grabbing peer connection information.
This is a bit overkill.  There are two situations:

a) Opening a connection to the peer
   In this case, we know the remote port/address a priori and can get
   the local information by just asking the OS.
b) Peer opening a connection to us.
   In this case, we know the local port/address a priori and can get
   the remote information by just asking the OS.

Modify the code to just grab this data at the appropriate time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-10 10:07:11 -05:00
Donald Sharp
78fa9b6feb bgpd: su_remote and su_local are properties of the connection
su_local and su_remote in the peer can change based upon
if we are initiating the remote connection or receiving it.
As such we need to treat it as a property of the connection.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-10 10:07:11 -05:00
Donald Sharp
0e416ff157 bgpd: bgp_getsockanme is connection oriented
Let's make it so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-10 10:06:16 -05:00
Donald Sharp
4c166947a8 zebra: Uninstall NHG in some situations
If you have this series of events:

a) Decision to install a NHG is made in zebra, enqueue to DPLANE
b) Changes to NHG are made and we remove it in the master pthread
   Since this NHG is not marked as installed it is not removed
   but the NHG data structure is deleted
c) DPLANE installs the NHG

In the end the NHG stays installed but ZEBRA has lost track of it.

Modify the removal code to check to see if the NHG is queued.
There are 2 cases:

a) NHG is kept around for a bit before being deleted.  In this case
just see that the NHG is Queued and keep it around too.

b) NHG is not kept around and we are just removing it.  In this case
check to see if it is queued and send another deletion event.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-10 09:35:35 -05:00
Donatas Abraitis
b4d640fc38
Merge pull request #17813 from enkechen-panw/aigp-fix6
bgpd: use igpmetric in bgp_aigp_metric_total()
2025-01-10 16:26:34 +02:00
Donald Sharp
d390f471f1
Merge pull request #17830 from opensourcerouting/fix/timers_bgp_default
bgpd: Fix showing default `timers bgp x y`
2025-01-10 09:24:00 -05:00
Donatas Abraitis
35c0c827f2
Merge pull request #17811 from enkechen-panw/aggr-fix3
bgpd: fix memory leak in bgp_aggregate_install()
2025-01-10 09:47:21 +02:00
Donatas Abraitis
485342fe35
Merge pull request #17831 from Jafaral/ospf6-nodebug
ospf6d: guard a couple of debugs
2025-01-10 09:45:20 +02:00
anlan_cs
a5ec72aa8c ospfd: avoid the redundant timers
Since the timer thread for ```OSPF_ROUTE_AGGR_DEL``` has been created,
the subsequent "no summary-address" commands shouldn't trigger redundant timers.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2025-01-10 08:51:40 +08:00
Jafar Al-Gharaibeh
83990851ba ospf6d: guard a couple of debugs
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-01-09 17:26:10 -06:00
Enke Chen
36ce18d278 bgpd: fix memory leak in bgp_aggregate_install()
Potential memory leak with as-set and matching-MED-only config.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-09 14:48:35 -08:00
Nathan Bahr
f75ec46dfb doc: Document rpf-lookup-mode changes
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Nathan Bahr
590c937e8a tests: Add tests for new RPF lookup group and source list features
Expand existing pim_mrib tests to include testing lookup modes
specific to source and/or group as defined in prefix lists.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Nathan Bahr
e8d81ab5ce pimd: Implement rpf lookup mode as a list
Add the support to store lookup modes as a sorted list.
List is non-unique and sorts mode with both lists < modes with one list < global mode (no lists).
This way, when finding the right mode, we will match a lookup using a prefix list before the global mode.
Add passing group address into all lookups (using nht cache and/or synchronous lookup).
Many areas don't have a group address, use PIMADDR_ANY if no valid group is needed.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Nathan Bahr
8b00575fbb pimd,yang: Expand rpf-lookup-mode command
Add options for group-list and source-list, both of which take a prefix list name.
The prefix list is used to determine the lookup mode for specific sources and/or groups.
Any number of lookup modes can be configured as long as the combination of group
and source list is unique.
A global lookup mode (empty group and source lists) is always added and defaults to mrib-then-urib
as it currently functions. The global lookup mode can be changed as it current exists with the command
`rpf-lookup-mode MODE`.
When determinig which mode to use, match source (and group if provided) against the lists, if they are set.
If a lookup does not specify a group, then only use lookup modes that do not have a group list defined.
A lookup by definition will have a source, so no special handling there.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Donatas Abraitis
76fc75de9e bgpd: Fix showing default timers bgp x y
Fixes: ef4a9215b9 ("bgpd: Reuse defined constants for BGP timers")
Fixes: ab3535fbcf ("bgpd: Implement connect retry backoff")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-09 23:56:31 +02:00
Jafar Al-Gharaibeh
3915dd5b53 tests: avoid nondeterministic route
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-01-09 15:44:25 -06:00
Jafar Al-Gharaibeh
7e3d4048a6
Merge pull request #17805 from donaldsharp/2_test_fixes
2 test fixes
2025-01-09 15:40:08 -06:00
Jafar Al-Gharaibeh
34431a38f1
Merge pull request #17809 from donaldsharp/nhg_fix
zebra: Fix leaked nhe
2025-01-09 15:38:54 -06:00
Donatas Abraitis
003869b179
Merge pull request #17801 from enkechen-panw/aggr-fix2
bgpd: apply route-map for aggregate before attribute comparison
2025-01-09 23:02:26 +02:00
Donatas Abraitis
0b48c8e134
Merge pull request #17807 from louis-6wind/fix-bgp-orf-crash
bgpd: fix crash in displaying json orf prefix-list
2025-01-09 22:57:51 +02:00
Donatas Abraitis
3c3c7fc08d
Merge pull request #17808 from louis-6wind/rem-if-dead
lib: remove interface dead code
2025-01-09 22:54:43 +02:00
Enke Chen
b89e66a3bc bgpd: use igpmetric in bgp_aigp_metric_total()
Use igpmetric from bgp_path_info in bgp_igp_metric_total() to be
consistent with all other cases, e.g., as in bgp_path_info_cmp().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-09 12:02:02 -08:00
Donald Sharp
414bc26bc0 tests: bgp_srv6l3vpn_to_bgp_vrf3 needs more time
The test starts with checking for rib insertion
of routes that may take some time after system
startup to come up.  Under heavy load this may
cause this test to just fail.  Give it more time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 13:43:58 -05:00
Louis Scalbert
5100d842f6 lib: remove interface dead code
Remove interface dead code.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:38:28 +01:00
Louis Scalbert
8ccf60921b bgpd: fix crash in displaying json orf prefix-list
bgpd crashes when there is several entries in the prefix-list. No
backtrace is provided because the issue was catched from a code review.

Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:35:18 +01:00
Louis Scalbert
b7e843d7e8 bgpd: fix bgp orf prefix-list json prefix
0x<address>FX was displayed instead of the prefix.

Fixes: b219dda129 ("lib: Convert usage of strings to %pFX and %pRN")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-09 18:35:18 +01:00
Donald Sharp
97fa24e70b zebra: Fix leaked nhe
During route processing in zebra, Zebra will create a nexthop
group that matches the nexthops passed down from the routing
protocol.  Then Zebra will look to see if it can re-use a
nhe from a previous version of the route entry( say a interface
goes down ).  If Zebra decides to re-use an nhe it was just dropping
the route entry created.  Which led to nexthop group's that had
a refcount of 0 and in some cases these nexthop groups were installed
into the kernel.

Add a bit of code to see if the returned entry is not being used
and it has no reference count and if so, properly dispose of it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 12:34:50 -05:00
Donald Sharp
b46d3a1a42 tests: bgp_srv6_sid_reachability should give more time
The test starts right in on check_pings with a 10 second
time out.  Any type of delay on startup is going to cause
problems.  Give the first check_ping significant time
for the test to be fully brought up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-09 10:31:07 -05:00
Jafar Al-Gharaibeh
465d286819
Merge pull request #17798 from mjstapp/fix_remove_clear_thread
libs: remove deprecated 'clear thread' cli
2025-01-09 09:01:33 -06:00
Enke Chen
43c5670141 bgpd: apply route-map for aggregate before attribute comparison
Currently when re-evaluating an aggregate route, the full attribute of
the aggregate route is not compared with the existing one in the BGP
table. That can result in unnecessary churns (un-install and then
install) of the aggregate route when a more specific route is added or
deleted, or when the route-map for the aggregate changes. The churn
would impact route installation and route advertisement.

The fix is to apply the route-map for the aggregate first and then
compare the attribute.

Here is an example of the churn:

debug bgp aggregate prefix 5.5.5.0/24
!
route-map set-comm permit 10
 set community 65004:200
!
router bgp 65001
 address-family ipv4 unicast
  redistribute static
  aggregate-address 5.5.5.0/24 route-map set-comm
!

Step 1:
  ip route 5.5.5.1/32 Null0

Jan  8 10:28:49 enke-vm1 bgpd[285786]: [J7PXJ-A7YA2] bgp_aggregate_install: aggregate 5.5.5.0/24, count 1
Jan  8 10:28:49 enke-vm1 bgpd[285786]: [Y444T-HEVNG]   aggregate 5.5.5.0/24: installed

Step 2:
  ip route 5.5.5.2/32 Null0

Jan  8 10:29:03 enke-vm1 bgpd[285786]: [J7PXJ-A7YA2] bgp_aggregate_install: aggregate 5.5.5.0/24, count 2
Jan  8 10:29:03 enke-vm1 bgpd[285786]: [S2EH5-EQSX6]   aggregate 5.5.5.0/24: existing, removed
Jan  8 10:29:03 enke-vm1 bgpd[285786]: [Y444T-HEVNG]   aggregate 5.5.5.0/24: installed
---

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-08 17:34:29 -08:00
Donatas Abraitis
929591cdb0 tests: Check if allowas-in works when importing between local VRFs
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-08 19:22:27 +02:00
Donatas Abraitis
0dd15189f9 bgpd: Respect allowas-in value from the source VRF's peer
If the peer which has allowas-in enabled and then reimports the routes to another
local VRF, respect that value.

This was working with < 10.2 releases.

Fixes: d4426b62d2 ("bgpd: copy source vrf ASN to leaked route and block loops")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-08 19:16:04 +02:00
Enke Chen
b0f96fc247 Revert "bgpd: Reinstall aggregated routes if using route-maps and it was changed"
This reverts commit ee1986f1b5.

The fix is incomplete, and is no longer needed with the fix that applies
the route-map for an aggregate and then compares the attribute.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-08 09:13:11 -08:00
Donald Sharp
3d7dbcf6c6
Merge pull request #17795 from gromit1811/bugfix_priv_syscaps_alloc
lib: Fix privs syscaps (pset_t) allocation
2025-01-08 10:20:11 -05:00
Mark Stapp
cb119907f0 libs: remove deprecated 'clear thread' cli
Remove a deprecated 'clear thread cpu' command.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-01-08 10:17:51 -05:00
Donald Sharp
068a637a46
Merge pull request #17778 from enkechen-panw/aggr-fix
bgpd: add a debug command for route aggregation
2025-01-08 08:57:54 -05:00
Lou Berger
e2b5eed59f doc: update redhat packaging doc with new options and use of Rocky 8 (Centos 8 is no more)
Signed-off-by: Lou Berger <lberger@labn.net>
2025-01-08 12:49:00 +00:00
Lou Berger
d89f21fc06 redhat: Add option to build pkg without docs and rpki support, allow for different system environments by including all built .so files
Simplify file list by using wildcards to include any built %{_libdir}/frr/modules/*.so and +%{_libdir}/libfrr*.so*

Signed-off-by: Lou Berger <lberger@labn.net>
2025-01-08 12:47:34 +00:00
Martin Buck
59ee9d2a79 lib: Handle call to zlog_5424_cycle() without valid FD properly
In zlog_5424_cycle(), struct zlt_5424 *zlt only points to valid memory when
the passed file descriptor is >= 0 (and passing -1 seems to be a supported
use case). So we shouldn't try to compute the address of its zt member when
zlt is NULL.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 13:30:40 +01:00
Martin Buck
9951da394a lib: Try to open 5424 log destination when changing log threshold
When changing the log threshold (prio_min) using zlog_5424_apply_meta(), try
to open the log destination using zlog_5424_open() if we haven't done so
before. Without this, we might never open the destination at all, because
when zlog_5424_apply_dst() gets called (which so far was the only initial
caller of zlog_5424_open()), chances are that prio_min is still at its
initial value of ZLOG_DISABLED, causing it to skip the call to
zlog_5424_open().

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 13:30:40 +01:00
Martin Buck
4ed9147d98 lib: Fix privs syscaps (pset_t) allocation
Don't over-allocate syscaps in zcaps2sys(): This is just a single struct
(pset_t) with a count and a pointer to an array of capabilities, not an
array. So only allocate a single pset_t, not num copies of it.

The allocation size of syscaps->caps then needs to be based on the number of
Linux capabilities (count), but that is already handled properly a few lines
below.

Note that this fix is mostly cosmetic and for correctness. There was no
potential for memory corruption, because num is guaranteed to be nonzero. So
at least the one required pset_t was always allocated (but potentially much
more).

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-01-08 10:38:56 +01:00
Enke Chen
2a19daa830 bgpd: add debugging command for route aggregation
Add a new debugging command:

  debug bgp aggregate [prefix <A.B.C.D/M|X:X::X:X/M>]

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-07 22:52:41 -08:00
Russ White
21fe1f4d83
Merge pull request #17707 from gromit1811/pr16811_rebased
tests: cleanup ospf6 ecmp inter area
2025-01-07 16:14:15 -05:00
Donald Sharp
cc07a4a200
Merge pull request #17772 from LabNConsulting/chopps/fix-oper-walk
improve error handling of operational state walk callback
2025-01-07 13:52:37 -05:00
Donald Sharp
96ab6ae32b
Merge pull request #17781 from LabNConsulting/chopps/fix-keyless-list-query
fix xpath query on keyless list with positional predicate
2025-01-07 13:17:37 -05:00
Donald Sharp
0a52c233d3
Merge pull request #17782 from LabNConsulting/chopps/new-notify-msg-fmt
New YANG notify msg fmt
2025-01-07 13:15:40 -05:00
Donald Sharp
1a7923e7bc
Merge pull request #17783 from LabNConsulting/chopps/new-oper-get-callback
Add new oper state get callback
2025-01-07 13:11:26 -05:00
Russ White
8168dd931d
Merge pull request #17725 from opensourcerouting/fix/full_no_form_for_area-password
isisd: Allow full `no` form for `domain-password` and `area-password`
2025-01-07 09:41:39 -05:00
Russ White
6060d8b347
Merge pull request #17723 from opensourcerouting/fix/bgpd_metric_worse
bgpd: Respect `bgp bestpath missing-as-worst` for `table-map` as well
2025-01-07 09:41:08 -05:00