Commit Graph

35189 Commits

Author SHA1 Message Date
Donald Sharp
321638388d
Merge pull request #17448 from opensourcerouting/fix/backport_65a43b57efd60c4fdf80c935750046ba861ec79f_10.0
bgpd: Validate both nexthop information (NEXTHOP and NLRI) (backport)
2024-11-19 09:29:24 -05:00
Donatas Abraitis
91790796bc bgpd: Validate both nexthop information (NEXTHOP and NLRI)
If we receive an IPv6 prefix e.g.: 2001:db8:100::/64 with nextop: 0.0.0.0, and
mp_nexthop: fc00::2, we should not treat this with an invalid nexthop because
of 0.0.0.0. We MUST check for MP_REACH attribute also and decide later if we
have at least one a valid nexthop.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit a0d2734e87)
2024-11-17 11:25:41 +02:00
Jafar Al-Gharaibeh
81c2fe3453
Merge pull request #17417 from FRRouting/mergify/bp/stable/10.0/pr-17402
bgpd: Fix for match source-protocol in route-map for redistribute cmd (backport) (backport #17402)
2024-11-12 11:45:12 -06:00
Rajasekar Raja
718b76fc3f bgpd: Fix for match source-protocol in route-map for redistribute cmd
A redistribute cmd can have a route-map attached to it and adding the
match source-protocol to that route-map means BGP to filter which
protocol routes to accept among the bunch of routes zebra is sending.

Fixing this since this wasnt implemented earlier.

Ticket :#4119692

Signed-off-by: Donald Sharp <sharpd@nvidia.com>

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
(cherry picked from commit 68358c0f92)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit f93e5aa166)
2024-11-12 15:02:54 +00:00
Russ White
930ee69279
Merge pull request #17405 from FRRouting/mergify/bp/stable/10.0/pr-15686
BGP TCP non established : get port and ip (backport #15686)
2024-11-12 10:02:11 -05:00
Philippe Guibert
9b50df7fe7 bgpd: fix addressing information of non established outgoing sessions
When trying to connect to a BGP peer that does not respons, the 'show
bgp neighbors' command does not give any indication on the local and
remote addresses used:

> # show bgp neighbors
>  BGP neighbor is 192.0.2.150, remote AS 65500, local AS 65500, internal link
>   Local Role: undefined
>   Remote Role: undefined
>   BGP version 4, remote router ID 0.0.0.0, local router ID 192.0.2.1
>   BGP state = Connect
> [..]
>   Connections established 0; dropped 0
>   Last reset 00:00:04,   Waiting for peer OPEN (n/a)
>   Internal BGP neighbor may be up to 255 hops away.
> BGP Connect Retry Timer in Seconds: 120
> Next connect timer due in 117 seconds
> Read thread: off  Write thread: off  FD used: 27

The addressing information (address and port) are only available
when TCP session is established, whereas this information is present
at the system level:

> root@ubuntu2204:~# netstat -pan | grep 192.0.2.1
> tcp        0      0 192.0.2.1:179           192.0.2.150:38060       SYN_RECV    -
> tcp        0      1 192.0.2.1:46526         192.0.2.150:179         SYN_SENT    488310/bgpd

Add the display for outgoing BGP session, as the information in
the getsockname() API provides information for connected streams.
When getpeername() API does not give any information, use the peer
configuration (destination port is encoded in peer->port).

> # show bgp neighbors
> BGP neighbor is 192.0.2.150, remote AS 65500, local AS 65500, internal link
>   Local Role: undefined
>   Remote Role: undefined
>   BGP version 4, remote router ID 0.0.0.0, local router ID 192.0.2.1
>   BGP state = Connect
> [..]
>   Connections established 0; dropped 0
>   Last reset 00:00:16,   Waiting for peer OPEN (n/a)
> Local host: 192.0.2.1, Local port: 46084
> Foreign host: 192.0.2.150, Foreign port: 179

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 78ce63952a)
2024-11-11 08:27:19 +00:00
Philippe Guibert
862a15da9b bgpd: remove useless control checks about TCP connection
When attempting to get the src and destination addresses of a given
connection, the API may return the NULL pointer, but further code
in bgp_zebra_nexthop_set() already does a check about the given
pointer.

Relaxing the error code for all the returned adressing.

Fixes: 1ff9a34058 ("bgpd: bgpd-fsm-fix.patch")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit ba71303099)
2024-11-11 08:27:19 +00:00
Donald Sharp
30129152c1
Merge pull request #17393 from opensourcerouting/fix/backport_17376_10.0
bgpd: Clear stale routes with multiple paths (backport)
2024-11-08 11:13:12 -05:00
Donatas Abraitis
896958317e bgpd: Set LLGR stale routes for all the paths including addpath
Without this patch we set only the first path for the route (if multiple exist)
as LLGR stale and stop doing that for the rest of the paths, which is wrong.

Fixes: 1479ed2fb3 ("bgpd: Implement LLGR helper mode")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-11-08 09:59:17 +02:00
Donatas Abraitis
099795ee61 bgpd: Clear all paths including addpath once GR expires
We iterated over all bgp_path_info's, but once we remove the path, we didn't
check for other paths under the same bgp_dest.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-11-08 09:58:48 +02:00
Donald Sharp
035b33f0db
Merge pull request #17349 from FRRouting/mergify/bp/stable/10.0/pr-17305
bgpd: Treat numbered community-list only if it's in a range 1-500 (backport #17305)
2024-11-05 14:27:07 -05:00
Donald Sharp
08c1bb1e86
Merge pull request #17354 from FRRouting/mergify/bp/stable/10.0/pr-17319
ospfd: Use router_id what Zebra has if we remove a static router_id (backport #17319)
2024-11-05 14:25:10 -05:00
Donatas Abraitis
a5fe2ec138 ospfd: Use router_id what Zebra has if we remove a static router_id
If we set router-id, e.g. `router-id x.x.x.x`, then we have:

```
pc.donatas.net# show ip ospf | include Router ID
 OSPF Routing Process, Router ID: x.x.x.x
```

But once we remove it (`no router-id x.x.x.x`), the old router-id remains.

This is kinda OK, but to be consistent with OSPFv3 we should use what Zebra
already has, instead of retaining the old one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 1073e0f9b3)
2024-11-05 15:21:04 +00:00
Donatas Abraitis
45a9295d87 ospfd: Add a hidden command for old no router-id
A new command is `ospf router-id ...`, but the old one is also valid. Just a no
form was missed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 80bfe6784f)
2024-11-05 15:21:04 +00:00
Donatas Abraitis
791cd3657c bgpd: Treat numbered community-list only if it's in a range 1-500
Before this patch, if we set something like:

```
bgp extcommunity-list expanded 1234 permit admin
```

In running config we have:

```
bgp extcommunity-list 1234 seq 5 permit admin
```

That leads to incorrect rendering, even more the line can't be deleted.

With this fix we treat numbered community-list only if it's inside the range
1-500, otherwise it's a non-numbered clist.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 4c1ee29116)
2024-11-05 15:17:31 +00:00
Mark Stapp
1b56305c73
Merge pull request #17323 from FRRouting/mergify/bp/stable/10.0/pr-17318
zebra: Add missing new line for help string (backport #17318)
2024-10-31 13:26:11 -04:00
Donatas Abraitis
c138594830
Merge pull request #17302 from FRRouting/mergify/bp/stable/10.0/pr-17250
isisd: fix change flex-algorithm number from uint32 to uint8 (backport #17250)
2024-10-31 17:21:22 +02:00
Donatas Abraitis
bdaf82c54d zebra: Add missing new line for help string
```
  -A, --asic-offload        FRR is interacting with an asic underneath the linux kernel
      --v6-with-v4-nexthops Underlying dataplane supports v6 routes with v4 nexthops  -s, --nl-bufsize          Set netlink receive buffer size
```

Fixes: 1f5611c06d ("zebra: Allow zebra cli to accept v6 routes with v4 nexthops")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 25ae643996)
2024-10-31 13:15:24 +00:00
Philippe Guibert
6b1cf330c4 isisd: fix change flex-algorithm number from uint32 to uint8
The algorithm number is encoded on 8 bits and does not require
an unsigned 32 bit value to store the value.

Fixes: cc4926c128 ("isisd,yang: add algorithm-prefix-sid configuration tree")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 8e861a75e8)
2024-10-30 08:44:08 +00:00
Russ White
7dddef2a49
Merge pull request #17288 from opensourcerouting/16354-bp-10.0
(10.0 backport) bgpd: add `bgp ipv6-auto-ra` command
2024-10-29 10:28:11 -04:00
Russ White
5a19a51f09
Merge pull request #17284 from FRRouting/mergify/bp/stable/10.0/pr-17278
bgpd: fix blank line in running-config with bmp listener cmd (backport #17278)
2024-10-29 10:26:34 -04:00
Russ White
58f9e8ebc7
Merge pull request #17293 from FRRouting/mergify/bp/stable/10.0/pr-17245
bgpd:  fix crash when polling bgp4v2PathAttrTable (backport #17245)
2024-10-29 10:22:41 -04:00
Francois Dumontet
c35b299b9f bgpd: fix crash when polling bgp4v2PathAttrTable
we have

(gdb) p *path->attr->aspath
$1 = {refcnt = 3, segments = 0x0, json = 0x0, str = 0x55723d0b7470 "", str_len = 0, asnotation = ASNOTATION_PLAIN}

It looks like this aspath is empty, resulting in a size 0 and NULL pointer for path->attr->aspath->segments which leads to the SIGSEGV

fixe: return 0 when segments is null.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit ee2f1b85cf)
2024-10-29 12:13:37 +00:00
Mikhail Sokolovskiy
44bf223d8b bgpd: add bgp ipv6-auto-ra command
Introduce a command to stop bgpd from enabling IPv6 router advertisement
messages sending on interfaces.

Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2024-10-29 12:12:19 +01:00
Philippe Guibert
5241a3652b bgpd: fix blank line in running-config with bmp listener cmd
An extra blank line is added in show running-config with BMP:

> ubuntu2204hwe(config)# router bgp 65500
> ubuntu2204hwe(config-router)# bmp targets tgt
> ubuntu2204hwe(config-bgp-bmp)# bmp monitor ipv4 unicast pre-policy
> ubuntu2204hwe(config-bgp-bmp)# bmp listener 192.0.2.100 port 44
> ubuntu2204hwe(config-bgp-bmp)# do show running-config
>
> router bgp 65500
> [..]
>  bmp targets tgt
>   bmp monitor ipv4 unicast pre-policy
>                                       <-- blank line
>   bmp listener 192.0.2.100 port 44
>  exit

Remove the blank line.

Fixes: ed18356f1f ("bgpd/bmp: BMP implementation")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 9a33ee18bf)
2024-10-29 08:58:17 +00:00
Jafar Al-Gharaibeh
4723daf608
Merge pull request #17274 from FRRouting/mergify/bp/stable/10.0/pr-17243
bgpd: fix display of local label in show bgp (backport #17243)
2024-10-28 15:15:08 -05:00
Jafar Al-Gharaibeh
9f1f461316
Merge pull request #17260 from FRRouting/mergify/bp/stable/10.0/pr-17160
lib, zebra: Keep `zebra on-rib-process script` in frr.conf (backport #17160)
2024-10-28 12:37:57 -05:00
Louis Scalbert
c8c11c0b84 bgpd: fix display of local label in show bgp
Fix the display of the local label in show bgp.

> r1# show bgp ipv4 labeled-unicast 172.16.2.2/32
> BGP routing table entry for 172.16.2.2/32, version 2
> Local label: 16 <---- MISSING
> Paths: (1 available, best #1, table default, vrf (null))
>   Advertised to non peer-group peers:
>  192.168.1.2
>  65501
>    192.168.1.2 from 192.168.1.2 (172.16.2.2)
>      Origin IGP, metric 0, valid, external, best (First path received)
>      Remote label: 3
>      Last update: Fri Oct 25 17:55:45 2024

Fixes: 67f67ba481 ("bgpd: Drop label_ntop/label_pton functions")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit e7b3276ace)
2024-10-28 14:37:07 +00:00
Jafar Al-Gharaibeh
c66186f646
Merge pull request #17247 from FRRouting/mergify/bp/stable/10.0/pr-17217
pimd: allow resolving bsr via directly connected secondary address (backport) (backport #17217)
2024-10-27 23:43:35 -05:00
Donatas Abraitis
51699110f3 lib, zebra: Keep zebra on-rib-process script in frr.conf
After the change:

```
$ grep on-rib-process /etc/frr/frr.conf
zebra on-rib-process script script4

$ systemctl restart frr

$ vtysh -c 'show run' | grep on-rib-process
zebra on-rib-process script script4
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 1fe1f8d87c)
2024-10-27 23:24:59 +00:00
Jafar Al-Gharaibeh
ae02210bdb pimd: allow resolving bsr via directly connected secondary address
This only matters to single hop nodes that are adjacent to the bsr. More common
with IPv6 where LL address is used in PIM as the primary address. If the BSR IP
happens to be an address on the same interface, the receiving pim router
rejects the BSR address because it expects the BSR IP to resolve via the LL address
even if we have a connected route for the same BSR IP subnet. Effectively, we want to
allow rpf to be resolved via secondary IPs with connected routes on the same interface,
and not limit them to primary addresses.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit d23a7d0949)
2024-10-25 20:07:31 +00:00
Jafar Al-Gharaibeh
4287007539
Merge pull request #17240 from opensourcerouting/fix/backport_d46511d4456ccaccfdac34b456c1c225a29609c8_10.0
bgpd: compare aigp after local route check in bgp_path_info_cmp()
2024-10-25 10:18:58 -05:00
Enke Chen
acc673dd88 bgpd: compare aigp after local route check in bgp_path_info_cmp()
For consistency between RIB and BGP, the aigp comparison should
be made after the local route check in bgp bestpath selection.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-25 13:15:32 +03:00
Donatas Abraitis
4f43c1392b
Merge pull request #17206 from louis-6wind/fix-bgp-labels-10.0
bgpd: fix uninitialized labels (backport 10.0)
2024-10-25 07:12:52 +03:00
Donatas Abraitis
11ce6aaedc
Merge pull request #17209 from cscarpitta/fix/backport_add-sid-structure-to-seg6local-nh_for_10.0
bgpd, lib: Include SID structure in seg6local nexthop (backport for 10.0)
2024-10-24 17:32:49 +03:00
Carmine Scarpitta
b6ec1a616d bgpd: Include structure when removing End.DT46 SID
Include SID structure information when removing an SRv6 End.DT46 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-23 17:30:34 +02:00
Carmine Scarpitta
d5ddc7e845 bgpd: Include structure when removing End.DT4/6 SID
Include SID structure information when removing an SRv6 End.DT4 or End.DT6 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-23 17:30:15 +02:00
Carmine Scarpitta
e6ad940ea8 bgpd: Include structure when installing End.DT46 SID
Include SID structure information when installing an SRv6 End.DT46 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-23 17:30:02 +02:00
Carmine Scarpitta
fd81e54916 bgpd: Include structure when installing End.DT4/6 SID
Include SID structure information when installing an SRv6 End.DT6 or End.DT4 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-23 17:29:53 +02:00
Carmine Scarpitta
7254ff67dd lib: Include SID structure in seg6local nexthop
Include SID structure information in seg6local nexthop data structure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-23 16:09:46 +02:00
Louis Scalbert
ab7857a3c4 bgpd: fix uninitialized labels
Fix uninitialized labels that cause multiple valgrind issues.

> ==3729602== Use of uninitialised value of size 8
> ==3729602==    at 0x492B493: hash_get (hash.c:140)
> ==3729602==    by 0x2629D2: bgp_labels_intern (bgp_label.c:98)
> ==3729602==    by 0x2E6C92: bgp_adj_out_set_subgroup (bgp_updgrp_adv.c:622)
> ==3729602==    by 0x2A6810: subgroup_process_announce_selected (bgp_route.c:3340)
> ==3729602==    by 0x2E5FF6: group_announce_route_walkcb (bgp_updgrp_adv.c:260)
> ==3729602==    by 0x2E3E28: update_group_walkcb (bgp_updgrp.c:1759)
> ==3729602==    by 0x492B9A0: hash_walk (hash.c:270)
> ==3729602==    by 0x2E498C: update_group_af_walk (bgp_updgrp.c:2090)
> ==3729602==    by 0x2E7C0D: group_announce_route (bgp_updgrp_adv.c:1119)
> ==3729602==    by 0x2A796E: bgp_process_main_one (bgp_route.c:3865)
> ==3729602==    by 0x2A808A: bgp_process_wq (bgp_route.c:3991)
> ==3729602==    by 0x49CC7CF: work_queue_run (workqueue.c:282)
> ==3729602==    by 0x49BBF25: event_call (event.c:2019)
> ==3729602==    by 0x49413CA: frr_run (libfrr.c:1238)
> ==3729602==    by 0x1FD1D3: main (bgp_main.c:555)

> ==2604268== Use of uninitialised value of size 8
> ==2604268==    at 0x4943016: hash_get (hash.c:159)
> ==2604268==    by 0x26EFC1: bgp_labels_intern (bgp_label.c:97)
> ==2604268==    by 0x28077B: leak_update (bgp_mplsvpn.c:1298)
> ==2604268==    by 0x2824A3: vpn_leak_from_vrf_update (bgp_mplsvpn.c:1932)
> ==2604268==    by 0x2C281C: bgp_static_update (bgp_route.c:6974)
> ==2604268==    by 0x2C366F: bgp_static_set (bgp_route.c:7263)
> ==2604268==    by 0x2C435B: bgp_network_magic (bgp_route.c:7556)
> ==2604268==    by 0x2ACF09: bgp_network (bgp_route_clippy.c:86)
> ==2604268==    by 0x4914EE7: cmd_execute_command_real (command.c:1003)
> ==2604268==    by 0x4915060: cmd_execute_command (command.c:1062)
> ==2604268==    by 0x4915610: cmd_execute (command.c:1228)
> ==2604268==    by 0x49E7C32: vty_command (vty.c:625)
> ==2604268==    by 0x49E9B56: vty_execute (vty.c:1388)
> ==2604268==    by 0x49EC331: vtysh_read (vty.c:2400)
> ==2604268==    by 0x49E06F1: event_call (event.c:2001)
> ==2604268==    by 0x495AB8B: frr_run (libfrr.c:1238)
> ==2604268==    by 0x200C4B: main (bgp_main.c:555)

Fixes: ddb5b4880b ("bgpd: vpn-vrf route leaking")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-23 09:44:49 +02:00
Donatas Abraitis
3718a7a1f8
Merge pull request #17203 from FRRouting/mergify/bp/stable/10.0/pr-17198
Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)
2024-10-23 09:19:03 +03:00
Russ White
1476d580ac
Merge pull request #17197 from FRRouting/mergify/bp/stable/10.0/pr-17165
bgpd: Do not filter no-export community for BGP OAD (backport #17165)
2024-10-22 21:16:34 -04:00
Donald Sharp
b18613b09f Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty"
This reverts commit 0e3c5e8e59.

(cherry picked from commit 6a36b9ef49)
2024-10-22 20:37:04 +00:00
Donatas Abraitis
13a290a30d tests: Check if BGP no-export community is passed to BGP OAD peers
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 7eaec540ec)
2024-10-22 15:07:35 +00:00
Donatas Abraitis
f6e58e0aab bgpd: Do not filter no-export community for BGP OAD (one administration domain)
OAD is treated as an _internal_ BGP peer, and some of the rules (including BGP
attributes) can be relaxed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit e63b1520f1)
2024-10-22 15:07:34 +00:00
Jafar Al-Gharaibeh
29ed8be6c0
Merge pull request #17177 from FRRouting/mergify/bp/stable/10.0/pr-17169
bgpd: allow value 0 in aigp-metric setting (backport #17169)
2024-10-22 09:39:06 -05:00
Enke Chen
2ddc17af93 bgpd: allow value 0 in aigp-metric setting
The value of 0 is accepted from peers, and can also be set by the
route-map "set aigp-metric igp-metric". For coonsistency, it should
be allowed in "set aigp-metric <value>" as well.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit e07f38a43f)
2024-10-21 08:34:36 +00:00
Donatas Abraitis
61754a1b7f
Merge pull request #17131 from FRRouting/mergify/bp/stable/10.0/pr-17116
zebra: unlock node only after operation in zebra_free_rnh() (backport #17116)
2024-10-18 14:57:03 +03:00
Jafar Al-Gharaibeh
27468ed434
Merge pull request #17148 from FRRouting/mergify/bp/stable/10.0/pr-17091
bgpd: fix several issues in sourcing AIGP attribute (backport #17091)
2024-10-17 11:29:54 -05:00