Commit Graph

35713 Commits

Author SHA1 Message Date
Louis Scalbert
ca32945b1f bgpd: move labels from extra to extra->labels
Move labels from extra to extra->labels. Labels are now stored in a hash
list.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert
3c86f776f0 bgpd: add bgp_labels hash
Add bgp_labels type and hash list.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Philippe Guibert
40706d5c42 topotests: add bgp test to check the ADJ-RIB-IN label value
The test is done on r2. A BGP update is received on r2, and is
filtered on r2. The RIB of r2 does not have the BGP update stored,
but the ADJ-RIB-IN is yet present. To demonstrate this, if the
inbound route-map is removed, then the BGP update should be copied
from the the ADJ-RIB-IN and added to the RIB with the label
value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Philippe Guibert
415befc30a topotests: add bgp test to check the ADJ-RIB-OUT label value
This test ensures that when r1 changes the label value, then
the new value is automatically propagated to remote peer.
This demonstrates that the ADJ-RIB-OUT to r2 has been correctly
updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert
191675451e topotests: clarify bgp_vpnv4_ebgp
Clarify bgp_vpnv4_ebgp

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert
a6de910448 bgpd: store number of labels with 8 bits
8 bits are sufficient to store the number of labels because the current
maximum is 2.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert
ae54c9e455 bgpd: fix too leading tabs in vnc_import_bgp
Small rework to fix the following checkpatch warning:

> < WARNING: Too many leading tabs - consider code refactoring
> < #2142: FILE: /tmp/f1-1616988/vnc_import_bgp.c:2142:

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:22 +02:00
Louis Scalbert
64fe15fd28 bgpd: add bgp_path_info_num_labels()
Add bgp_path_info_num_labels() to get the number of labels stored in
a path_info structure.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
1fcedd00d1 bgpd: rework vni printing in route_vty_out_detail()
In route_vty_out_detail(), tag_buf stores a string representation of
the VNI label.

Rename tag_buf to vni_buf for clarity and rework the code a little bit
to prepare the following commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
c27ad43694 bgpd: num_labels cannot be greater than BGP_MAX_LABELS
num_labels cannot be greater than BGP_MAX_LABELS by design.

Remove the check and the override.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
04748e36a5 bgpd: add bgp_path_info_labels_same()
Add bgp_path_info_labels_same() to compare labels with labels from
path_info. Remove labels_same() that was used for mplsvpn only.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
9771f1a03e bgpd: optimize label copy for new path_info
In bgp_update(), path_info *new has just been created and has void
labels. bgp_labels_same() is always false.

Do not compare previous labels before setting them.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
e93fa4daf0 bgpd: do not init labels in extra
No need to init labels at extra allocation. num_labels is the number
of set labels in label[] and is initialized to 0 by default.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
7a513e3361 bgpd: add bgp_path_info_has_valid_label()
Add bgp_path_has_valid_label to check that a path_info has a valid
label.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Louis Scalbert
747da057e8 bgpd: check and set extra num_labels
The handling of MPLS labels in BGP faces an issue due to the way labels
are stored in memory. They are stored in bgp_path_info but not in
bgp_adj_in and bgp_adj_out structures. As a consequence, some
configuration changes result in losing labels or even a bgpd crash. For
example, when retrieving routes from the Adj-RIB-in table
("soft-reconfiguration inbound" enabled), labels are missing.

bgp_path_info stores the MPLS labels, as shown below:

> struct bgp_path_info {
>   struct bgp_path_info_extra *extra;
>   [...]
> struct bgp_path_info_extra {
>	mpls_label_t label[BGP_MAX_LABELS];
>	uint32_t num_labels;
>   [...]

To solve those issues, a solution would be to set label data to the
bgp_adj_in and bgp_adj_out structures in addition to the
bgp_path_info_extra structure. The idea is to reference a common label
pointer in all these three structures. And to store the data in a hash
list in order to save memory.

However, an issue in the code prevents us from setting clean data
without a rework. The extra->num_labels field, which is intended to
indicate the number of labels in extra->label[], is not reliably checked
or set. The code often incorrectly assumes that if the extra pointer is
present, then a label must also be present, leading to direct access to
extra->label[] without verifying extra->num_labels. This assumption
usually works because extra->label[0] is set to MPLS_INVALID_LABEL when
a new bgp_path_info_extra is created, but it is technically incorrect.

Cleanup the label code by setting num_labels each time values are set in
extra->label[] and checking extra->num_labels before accessing the
labels.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Donatas Abraitis
b9c97686ac doc: Add missing clear bgp ASNUM command
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-05 08:35:34 +03:00
Acee Lindem
3f359d732c ospf6d: OSPFv3 manual key authentication neglects checking the SA ID.
Also, add topotest variation to verify checking.

    This corrects https://github.com/FRRouting/frr/issues/16100.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-06-04 21:24:46 +00:00
Donatas Abraitis
f153b9a9b6 bgpd: Ignore auto created VRF BGP instances
Configuration:

```
vtysh <<EOF
configure

vrf vrf100
 vni 10100
exit-vrf

router bgp 50
 address-family l2vpn evpn
  advertise-all-vni
 exit-address-family
exit

router bgp 100 vrf vrf100
exit
EOF
```

TL;DR; When we configure `advertise-all-vni` (in this case), a new BGP instance
is created with the name vrf100, and ASN 50. Next, when we create
`router bgp 100 vrf vrf100`, we look for the BGP instance with the same name
and we found it, but ASNs are different 50 vs. 100.

Every such a new auto created instance is flagged with BGP_VRF_AUTO.

After the fix:

```
router bgp 50
 !
 address-family l2vpn evpn
  advertise-all-vni
 exit-address-family
exit
!
router bgp 100 vrf vrf100
exit
!
end
donatas.net(config)# router bgp 51
BGP is already running; AS is 50
donatas.net(config)# router bgp 50
donatas.net(config-router)# router bgp 101 vrf vrf100
BGP is already running; AS is 100
donatas.net(config)# router bgp 100 vrf vrf100
donatas.net(config-router)#
```

Fixes: https://github.com/FRRouting/frr/issues/16152
Fixes: https://github.com/FRRouting/frr/issues/9537

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-04 18:03:22 +03:00
Russ White
17e1f7c2ff
Merge pull request #16160 from opensourcerouting/fix/revert_39e27b840e5ddc2087c0b20cfcf379745b3baa79
Revert "isisd: When the metric-type is configured as "wide", the IS-I…
2024-06-04 10:56:33 -04:00
Donatas Abraitis
07573cf98b Revert "isisd: When the metric-type is configured as "wide", the IS-IS generates incorrect metric values for IPv4 directly connected routes."
This broke these topotests:

test_isis_lsp_bits_topo1
test_isis_sr_topo1
test_isis_srv6_topo1
test_isis_tilfa_topo1
test_isis_topo1
test_isis_topo1_vrf
test_ldp_snmp_topo1
test_ldp_sync_isis_topo1

This reverts commit 39e27b840e.
2024-06-04 17:31:40 +03:00
Russ White
fb4e4b5fb2
Merge pull request #16056 from zhou-run/202405211622
isisd: When the metric-type is configured as "wide", the IS-IS generates incorrect metric values for IPv4 directly connected routes.
2024-06-04 07:53:30 -04:00
Georgi Valkov
f7242fbf73
zebra: fix compilation with GCC14
Fixes:
zebra/zebra_netns_notify.c: In function 'zebra_ns_ready_read':
zebra/zebra_netns_notify.c:266:40: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
  266 |         if (strmatch(VRF_DEFAULT_NAME, basename(netnspath))) {
      |                                        ^~~~~~~~

Fixed by including libgen.h, then since basename may modify its
parameter, allocate a copy on the stack, using strdupa, and pass the
temporary string to basename.

According to the man page for basename:
With glibc, one gets the POSIX version of basename() when
<libgen.h> is included, and the GNU version otherwise.

The POSIX version of basename may modify the contents of path,
so we should to pass a copy when calling this function.

[1] https://man7.org/linux/man-pages/man3/basename.3.html

Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
2024-06-04 13:35:57 +03:00
Donatas Abraitis
a24c8050e1
Merge pull request #16150 from LabNConsulting/chopps/native-message-comments
lib: comments about public vs private message apis
2024-06-04 11:49:42 +03:00
Çağatay Erem
a5f82baa9b docker: fix chmod issues when running debian container
I had problem by running container after build.
It gave the error below in container,

[FATAL tini (7)] exec /usr/lib/frr/docker-start failed: Permission denied

So I have fixed the permission issues after building images.

Signed-off-by: Çağatay Erem <cagatayerem@gmail.com>
2024-06-04 11:17:02 +03:00
Philippe Guibert
890b67d7a9 zebra: display srv6 encapsulation source-address when configured
The 'show running-config' does not display the ipv6 source address
when a locator is not configured. Fix this by systematically displaying
the ipv6 source address.

Fixes: 6a0956169b ("zebra: Add encap source address to SRv6 config write function")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-04 09:55:21 +02:00
Christian Hopps
41c236120f lib: comments about public vs private message apis
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-04 00:51:33 -04:00
Donatas Abraitis
41eb06801c
Merge pull request #16142 from LabNConsulting/chopps/fix-conflict-workflow
ci: only run conflict check on pull-requests
2024-06-02 21:13:29 +03:00
Donatas Abraitis
aeab88f5c7
Merge pull request #16146 from dpward/bgp-dscp
bgpd: Adjust terminology related to DSCP
2024-06-02 21:12:13 +03:00
Christian Hopps
7b76c8f67b ci: only run conflict check on pull-requests
This change will stop this action from running on forked repos.
Previously whenever one pushed a change to one's development branch the
action would "run but skip" which still generated an email notifications
and thus was very annoying. :)

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-02 10:14:34 -04:00
David Ward
172dd682d9 bgpd: Adjust terminology related to DSCP
The default DSCP used for BGP connections is CS6. The DSCP value is
not part of the TCP header.

When setting the IP_TOS or IPV6_TCLASS socket options, the argument
is not the 6-bit DSCP value, but an 8-bit value for the former IPv4
Type of Service field or IPv6 Traffic Class field, respectively.

Fixes: 425bd64be8 ("bgpd: Allow bgp to control the DSCP session TOS value")
Signed-off-by: David Ward <david.ward@ll.mit.edu>
2024-06-02 06:44:59 -04:00
Christian Hopps
8954dd3a6b
Merge pull request #16139 from donaldsharp/mroute_error
pimd: Give a clearer warning when the kernel is not compiled right
2024-06-01 10:41:49 -04:00
Donald Sharp
894e72895e
Merge pull request #16127 from opensourcerouting/fix/eor_not_only_for_gr
bgpd: Send End-of-RIB not only if Graceful Restart capability is received
2024-06-01 10:08:25 -04:00
Donald Sharp
517bdaa313
Merge pull request #16121 from LabNConsulting/chopps/docker-update
Update ubuntu docker images adding github build and test action
2024-06-01 10:02:05 -04:00
Christian Hopps
15a33df79c github: add docker build and test github action
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-05-31 18:54:01 -04:00
Donald Sharp
5ef144ce6d pimd: Give a clearer warning when the kernel is not compiled right
When the kernel is not compiled with mroute vrf's enabled it will
fail the call to initialize the vrf.  As such let's recognize this
specific error code and output a specific warning to the operator
to help them figure this problem out.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-31 11:29:40 -04:00
Christian Hopps
854caad3ea docker: update docker reference to follow latest docs
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-05-31 11:13:16 -04:00
Jafar Al-Gharaibeh
cdc964c233
Merge pull request #16111 from donaldsharp/ospfv3_read_after
ospf6d: Prevent heap-buffer-overflow with unknown type
2024-05-31 10:09:24 -05:00
Donald Sharp
85120c06f1
Merge pull request #16115 from Jafaral/pim-ssm-any
pimd: fix crash when mixing ssm/any-source joins
2024-05-31 10:57:29 -04:00
Donald Sharp
b1f404322e
Merge pull request #16125 from opensourcerouting/ts-expand-fix-guard
lib: make `python/ts_expand.py` actually work
2024-05-31 10:48:15 -04:00
Donald Sharp
9069c93e75
Merge pull request #16124 from LabNConsulting/chopps/test-cleanup
Fix grpc-client parallel run and other small test fixes
2024-05-31 10:47:52 -04:00
Mike RE Mallin
a514e34e30 bgpd, lib, zebra: Extend ES_VTEP_LIST_STR_SZ to support IPv6 addresses
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
f450332476 tests: Extend prefix_sg print UT for IPv6
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
f4f19cc20f lib, zebra: Update prefix_sg structure for IPv6 group support
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
b69ec60dc6 lib: Make the ip arg const in stream_put_ipaddr
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
b30523d3c9 lib: Add clang-format wrapper around printfrr_ext
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
f381bc2148 lib: Add ipaddr_is_same to compare IPv6 addresses
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
75e8750142 lib: Add SET_IPADDR_NONE macro
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:21 -04:00
Donatas Abraitis
637ab53f75 bgpd: Send End-of-RIB not only if Graceful Restart capability is received
Before we checked for received Graceful Restart capability, but that was also
incorrect, because we SHOULD HAVE checked it per AFI/SAFI instead.

https://datatracker.ietf.org/doc/html/rfc4724 says:

Although the End-of-RIB marker is specified for the purpose of BGP
   graceful restart, it is noted that the generation of such a marker
   upon completion of the initial update would be useful for routing
   convergence in general, and thus the practice is recommended.

Thus, it might be reasonable to send EoR regardless of whether the Graceful Restart
capability is received or not from the peer.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-31 15:03:55 +03:00
David Lamparter
5daf64f63b lib: make python/ts_expand.py actually work
lib/typesafe.h was supposed to be outside the _TYPESAFE_EXPAND_MACROS
guard, so that including lib/atomlist.h grabs all the typesafe container
macros.

(No effect on normal build, as _TYPESAFE_EXPAND_MACROS is never defined
there.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-31 11:32:05 +02:00
Christian Hopps
30d3b4d47e tests: use raw string for doc to avoid deprecated python warning
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-05-31 05:16:22 -04:00