Commit Graph

37380 Commits

Author SHA1 Message Date
Louis Scalbert
ddf09413d1 bgpd: export labels to pre-policy bmp
Export labels to pre-policy BMP

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-03 16:01:12 +02:00
Donald Sharp
842009fd55
Merge pull request #16992 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
2024-10-03 09:34:00 -04:00
Donald Sharp
f5dbc4031b
Merge pull request #16989 from opensourcerouting/fix/unreachable_code
bgpd: Print debug message about reaching maximum allowed multi paths
2024-10-03 08:29:55 -04:00
Louis Scalbert
db7b9a5a70 lib: remove unused bfd defines
Remove unused bfd defines

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-03 13:37:55 +02:00
Louis Scalbert
b5a23c029c bfdd: add no variants to all configurations
Continue the work of b70835d690 ("bfdd: add no variants to interval
configurations")

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-03 13:09:56 +02:00
sri-mohan1
c986690948 bgpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-10-03 16:32:31 +05:30
Donatas Abraitis
20710da797 bgpd: Print debug message about reaching maximum allowed multi paths
Fixes: 421cf856ef ("bgpd: Cleanup multipath figuring out in bgp")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-03 09:20:40 +03:00
Donatas Abraitis
cc7951d754
Merge pull request #16978 from donaldsharp/dmed_deselect_not_used
bgpd: Remove unused bgp_mp_dmed_deselect function
2024-10-03 07:05:13 +03:00
Donatas Abraitis
56d6a1a81e
Merge pull request #16977 from louis-6wind/fix-printfrr_bp
bgpd: fix printfrr_bp for non initialized peers
2024-10-02 18:57:59 +03:00
Donald Sharp
46df84f855
Merge pull request #16971 from opensourcerouting/fix/v6-with-v4-nexthops
bgpd: Actually make ` --v6-with-v4-nexthops` it work
2024-10-02 11:08:13 -04:00
Donald Sharp
49944f77fe bgpd: Remove unused bgp_mp_dmed_deselect function
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-02 10:55:32 -04:00
Donatas Abraitis
3fa917044e
Merge pull request #16967 from donaldsharp/nexthop_fixes
lib: nexthop code should use uint16_t for nexthop counting
2024-10-02 16:10:34 +03:00
Louis Scalbert
b56cfc6c80 bgpd: fix printfrr_bp for non initialized peers
Fix printfrr_bp for non initialized peers. For example:

> Sep 26 17:56:44 r1 bgpd[26295]: [GJPH1-W8PZV] Resetting peer (null)(Unknown) due to change in addpath config

Is now:

> Oct 02 14:00:59 r1 bgpd[12795]: [MNE5N-K0G4Z] Resetting peer 2.2.2.2 due to change in addpath config

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-02 14:50:28 +02:00
Donald Sharp
cbd4c875a6
Merge pull request #16968 from opensourcerouting/bfd-no-commands
bfdd: add no variants to interval configurations
2024-10-02 08:40:14 -04:00
Donatas Abraitis
9f9d24050d
Merge pull request #16961 from donaldsharp/mp_info_changes
Mp info changes
2024-10-02 14:53:04 +03:00
Donatas Abraitis
0495cac837 bgpd: Actually make --v6-with-v4-nexthops it work
It was using `-v` which is actually a _version_.

Fixes: 0435b31bb8 ("bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthops")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-02 13:57:30 +03:00
Rafael Zalamena
b70835d690 bfdd: add no variants to interval configurations
Add missing no commands to various interval configurations.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-10-01 18:58:24 -03:00
Donald Sharp
0bc79f5e51 lib: nexthop code should use uint16_t for nexthop counting
It's possible to specify via the cli and configure how many
nexthops that are allowed on the system.  If you happen to
have > 255 then things are about to get interesting otherwise.

Let's allow up to 65k nexthops (ha!)

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 15:38:14 -04:00
Jafar Al-Gharaibeh
65f27f2998
Merge pull request #16952 from anlancs/fix/tools-pim-interface-wrong
tools: fix missing check interfaces for reloading pim
2024-10-01 14:30:35 -05:00
Jafar Al-Gharaibeh
01a1f3fb2a
Merge pull request #16955 from anlancs/fix/pimd-add-v4v6-check
pimd: fix missing IPV4 check
2024-10-01 14:28:28 -05:00
Donatas Abraitis
dab1441128 tests: Check if loopback routes are considered valid for nexthop tracking
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-01 21:08:28 +03:00
Donatas Abraitis
c66642d7f0 bgpd: Relax the same prefix and nexthop to be valid
Treat as next-hop invalid if import check is enabled.

Fixes: 654a5978f6 ("bgpd: prevent routes loop through itself")

Fixes: https://github.com/FRRouting/frr/issues/16877

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-01 21:07:54 +03:00
Donatas Abraitis
2c6eb34af8 tests: Drop test_bgp_with_loopback_with_same_subnet_p1
It's replaced and simplified by c3fd1e9520c619babb3004cea6df622ca67b0dfa.

JSON topo is just horrible to debug.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-01 21:05:52 +03:00
Donald Sharp
5b8bca89b8 bgpd: Remove bgp_path_info_mpath_dequeue
This function is no doing any work.  Let's remove.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 12:25:57 -04:00
Donald Sharp
421cf856ef bgpd: Cleanup multipath figuring out in bgp
Currently bgp multipath has these properties:

a) mp_info may or may not be on a single path, based
upon path perturbations in the past.
b) mp_info->count started counting at 0( meaning 1 ).  As that the
bestpath path_info was never included in the count
c) The first mp_info in the list held the multipath data associated
with the multipath.  As such if you were at any other node that data
was not filled in.
d) As such the mp_info's that are not first on the list basically
were just pointers to the corresponding bgp_path_info that was in
the multipath.
e) On bestpath calculation, a linklist(struct linklist *) of bgp_path_info's was
created.
f) This linklist was passed in to a comparison function that took the
old mpinfo list and compared it item by item to the linklist and
doing magic to figure out how to create a new mp_info list.
g) the old mp_info and the link list had to be memory managed and
freed up.
h) BGP_PATH_MULTIPATH is only set on non bestpath nodes in the
multipath.

This is really complicated.  Let's change the algorithm to this:

a) When running bestpath, mark a bgp_path_info node that could be in the ecmp path as
BGP_PATH_MULTIPATH_NEW.
b) When running multipath, just walk the list of bgp_path_info's and if
it has BGP_PATH_MULTIPATH_NEW on it, decide if it is in BGP_MULTIPATH.
If we run out of space to put in the ecmp, clear the flag on the rest.
c) Clean up the counting of sometimes adding 1 to the mpath count.
d) Only allocate a mpath_info node for the bestpath.  Clean it up
when done with it.
e) remove the unneeded list management associated with the linklist and
the mp_list.

This greatly simplifies multipath computation for bgp and reduces memory
load for large scale deployments.

2 full feeds in work_queue_run prior:

    0      56367.471      1123    50193    493695    50362    493791         0         0          0    TE   work_queue_run

BGP multipath info            :  1941844     48   110780992  1941844 110780992

2 full feeds in work_queue_run after change:

    1      52924.931      1296    40837    465968    41025    487390         0         0          1    TE   work_queue_run

BGP multipath info            :   970860     32    38836880   970866  38837120

Aproximately 4 seconds of saved cpu time for convergence and ~75 mb
smaller run time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 12:25:57 -04:00
Donald Sharp
6ff85fc748 tests: Clean up some logging in test_bgp_default_originate_2links.py
Test was confusing.  Add some useful data and clean up some debugs

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 12:25:57 -04:00
Donald Sharp
6e0fe595f1 bgpd: Ensure mpath data is only on bestpath
The mpath data structure has data that is only relevant
for the first mpath in the list.  It is not being used
anywhere else.  Let's document that a bit more.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 12:25:57 -04:00
Donald Sharp
068aea1013 bgpd: Use CHECK_FLAG to remain consistent for mp_flags
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-01 09:14:55 -04:00
Jafar Al-Gharaibeh
237152fcb5
Merge pull request #16958 from opensourcerouting/calloc-warning-fix
lib: fix calloc warning on recent compiler
2024-09-30 12:42:12 -05:00
Jafar Al-Gharaibeh
a8482dbe6e
Merge pull request #16957 from opensourcerouting/pim-fixes
pimd: miscellaneous fixes
2024-09-30 12:07:50 -05:00
Rafael Zalamena
3941fb4cc7
Merge pull request #16938 from btrent98/autorp-topotest
pimd: enhance topotest of autorp, fix autorp cli bug
2024-09-30 12:49:05 -03:00
Rafael Zalamena
660146b57a lib: fix calloc warning on recent compiler
Fix the following compiler warning:
```
lib/elf_py.c: In function _elffile_load_:
lib/elf_py.c:1310:34: warning: _calloc_ sizes specified with _sizeof_ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
 1310 |         w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum);
      |                                  ^~~~~~~~
lib/elf_py.c:1310:34: note: earlier argument should specify number of elements, later size of each element
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-09-30 11:31:56 -03:00
Rafael Zalamena
e1338f5ade pimd: fix northbound error message on delete
`snprintf` doesn't know about `%pPAs` use `snprintfrr` instead.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-09-30 11:13:25 -03:00
Rafael Zalamena
30eb4b73ff pimd: remove unreachable code
MLD code is IPv6 only so the define `PIM_IPV` will never be 4.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-09-30 11:05:43 -03:00
anlan_cs
5291228bf7 pimd: fix missing IPV4 check
In `pim_if_addr_add()`, some code inside `PIM_IPV == 4`
( the case of `igmp->mtrace_only` ) wrongly accepts ipv6 address.

So, clearly add IPV4 check.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-09-30 13:31:29 +08:00
anlan_cs
1276eaaa90 tools: fix missing check interfaces for reloading pim
Without checking interfaces, the other interfaces' changes will be wrongly
lost.

Running config:
```
interface A
ip pim
ip pim use-source 11.0.0.1
exit
!
interface B
ip pim
ip pim use-source 22.0.0.1
exit
!
```

Reload the new config:
```
interface A
exit
!
interface B
ip pim
exit
```

Before:
```
2024-09-29 10:08:27,686  INFO: Executed "interface A  no ip pim exit"
```

After:
```
2024-09-29 10:05:01,356  INFO: Executed "interface A  no ip pim exit"
2024-09-29 10:05:01,376  INFO: Executed "interface B  no ip pim use-source 22.0.0.1 exit"
```

Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-09-29 10:51:39 +08:00
Barry A. Trent
41fa154163 tests: enhance autorp topotest
Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
2024-09-27 13:39:50 -07:00
Barry A. Trent
ba4555c646 pimd: fix autorp CLI bugs
Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
2024-09-27 13:39:30 -07:00
Donatas Abraitis
6e4bee2d33 tests: Check if match src-peer ... can be used for incoming route-map
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 23:01:07 +03:00
Donatas Abraitis
f153998874 bgpd: Fallback to destination peer when using match src-peer ...
If using at incoming direction, e.g.:

route-map test permit 10
 match src-peer 10.0.0.1
!
router bgp 65000
 neighbor 10.0.0.1 route-map test in
!

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 23:01:07 +03:00
Donatas Abraitis
791e34258f tests: Test if match src-peer ... works
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 23:01:07 +03:00
Donatas Abraitis
b969f4e544 doc: Add match src-peer ... command
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 23:01:07 +03:00
Donatas Abraitis
5d3da70ba3 bgpd: Implement match src-peer ... command
To match source peer on the outgoing direction.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 23:01:06 +03:00
Donatas Abraitis
419e024b3f bgpd: Add back pointer to source (from) peer in bgp_path_info struct
This is handy when you need to do source matching e.g. `match src-peer ...`
on outgoing direction with a route-map.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 22:53:46 +03:00
Donatas Abraitis
f4c17673d1 tests: Check if we can see unmodified received-routes with soft inbound
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 14:04:59 +03:00
Donatas Abraitis
60016a8e8b bgpd: Show unmodified version of received-routes per neighbor
If we have soft inbound enabled, we should see how the route looks like
before it was modified by a route-map/prefix-list.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 13:59:42 +03:00
b29332
06b5601c62 isisd: Fix the PQ space computation error in TI-LFA
When there are pseudo-nodes on the device, during TI-LFA calculation of PQ space, even if this IS vertex is not originally a P/Q node, it might be calculated as a P/Q node due to the presence of pseudo-nodes, causing this IS vertex to become a P/Q node.

Signed-off-by: baozhen-H3C <bao.zhen@h3c.com>
2024-09-27 16:12:45 +08:00
Donatas Abraitis
8b1b5315c3
Merge pull request #16939 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
2024-09-27 08:53:38 +03:00
Donatas Abraitis
51e11e19ac
Merge pull request #16934 from donaldsharp/clang_format
*: Modify clang-format column limit to 100
2024-09-27 08:49:31 +03:00
Rajasekar Raja
aa4786642c zebra: vlan to dplane Offload from main
Trigger: Zebra core seen when we convert l2vni to l3vni and back

BackTrace:
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(_zlog_assert_failed+0xe9) [0x7f4af96989d9]
/usr/lib/frr/zebra(zebra_vxlan_if_vni_up+0x250) [0x5561022ae030]
/usr/lib/frr/zebra(netlink_vlan_change+0x2f4) [0x5561021fd354]
/usr/lib/frr/zebra(netlink_parse_info+0xff) [0x55610220d37f]
/usr/lib/frr/zebra(+0xc264a) [0x55610220d64a]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(thread_call+0x7d) [0x7f4af967e96d]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(frr_run+0xe8) [0x7f4af9637588]
/usr/lib/frr/zebra(main+0x402) [0x5561021f4d32]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a) [0x7f4af932624a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f4af9326305]
/usr/lib/frr/zebra(_start+0x21) [0x5561021f72f1]

Root Cause:
In working case,
 - We get a RTM_NEWLINK whose ctx is enqueued by zebra dplane and
   dequeued by zebra main and processed i.e.
   (102000 is deleted from vxlan99) before we handle RTM_NEWVLAN.
 - So in handling of NEWVLAN (vxlan99) we bail out since find with
   vlan id 703 does not exist.

root@leaf2:mgmt:/var/log/frr# cat ~/raja_logs/working/nocras.log  | grep "RTM_NEWLINK\|QUEUED\|vxlan99\|in thread"
2024/07/18 23:09:33.741105 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=616, seq=0, pid=0
2024/07/18 23:09:33.744061 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7f2244000cf0, op INTF_INSTALL, ifindex (65), result QUEUED
2024/07/18 23:09:33.767240 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=508, seq=0, pid=0
2024/07/18 23:09:33.767380 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7f2244000cf0, op INTF_INSTALL, ifindex (73), result QUEUED
2024/07/18 23:09:33.767389 ZEBRA: [NVFT0-HS1EX] INTF_INSTALL for vxlan99(73)
2024/07/18 23:09:33.767404 ZEBRA: [TQR2A-H2RFY] Vlan-Vni(1186:1186-6000002:6000002) update for VxLAN IF vxlan99(73)
2024/07/18 23:09:33.767422 ZEBRA: [TP4VP-XZ627] Del L2-VNI 102000 intf vxlan99(73)
2024/07/18 23:09:33.767858 ZEBRA: [QYXB9-6RNNK] RTM_NEWVLAN bridge IF vxlan99 NS 0
2024/07/18 23:09:33.767866 ZEBRA: [KKZGZ-8PCDW] Cannot find VNI for VID (703) IF vxlan99 for vlan state update >>>>BAIL OUT

In failure case,
 - The NEWVLAN is received first even before processing RTM_NEWLINK.
 - Since the vxlan id 102000 is not removed from the vxlan99,
   the find with vlan id 703 returns the 102000 one and we invoke
   zebra_vxlan_if_vni_up where the interfaces don't match and assert.

root@leaf2:mgmt:/var/log/frr# cat ~/raja_logs/noworking/crash.log | grep "RTM_NEWLINK\|QUEUED\|vxlan99\|in thread"
2024/07/18 22:26:43.829370 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=616, seq=0, pid=0
2024/07/18 22:26:43.829646 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7fe07c026d30, op INTF_INSTALL, ifindex (65), result QUEUED
2024/07/18 22:26:43.853930 ZEBRA: [QYXB9-6RNNK] RTM_NEWVLAN bridge IF vxlan99 NS 0
2024/07/18 22:26:43.853949 ZEBRA: [K61WJ-XQQ3X] Intf vxlan99(73) L2-VNI 102000 is UP >>> VLAN PROCESSED BEFORE INTF EVENT
2024/07/18 22:26:43.853951 ZEBRA: [SPV50-BX2RP] RAJA zevpn_vxlanif vxlan48 and ifp vxlan99
2024/07/18 22:26:43.854005 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=508, seq=0, pid=0
2024/07/18 22:26:43.854241 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=516, seq=0, pid=0
2024/07/18 22:26:43.854251 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=544, seq=0, pid=0
ZEBRA: in thread kernel_read scheduled from zebra/kernel_netlink.c:505 kernel_read()

Fix:
Similar to #13396, where link change
handling was offloaded to dplane, same is being done for vlan events.

Note: Prior to this change, zebra main thread was interested in the
RTNLGRP_BRVLAN. So all the kernel events pertaining to vlan was
handled by zebra main.

With this change change as well the handling of vlan events is still
with Zebra main. However we offload it via Dplane thread.

Ticket :#3878175

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-09-26 20:17:35 -07:00