summaryrefslogtreecommitdiff
path: root/lib/srv6.c
AgeCommit message (Collapse)Author
2024-04-03lib: add srv6 bsid to seg6local_context2strPhilippe Guibert
Add SRv6 Binding SID END.B6.Encaps nh6 str to lib. It is used to display nh6 when one uses 'show ipv6 route'. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-11-29bgpd: Free Memory for SRv6 Functions and Locator ChunksKeelan10
Implement proper memory cleanup for SRv6 functions and locator chunks to prevent potential memory leaks. The list callback deletion functions have been set. The ASan leak log for reference: ``` *********************************************************************************** Address Sanitizer Error detected in bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.asan.bgpd.4180 ================================================================= ==4180==ERROR: LeakSanitizer: detected memory leaks Direct leak of 544 byte(s) in 2 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) #1 0x7f8d1709f238 in qcalloc lib/memory.c:105 #2 0x55d5dba6ee75 in sid_register bgpd/bgp_mplsvpn.c:591 #3 0x55d5dba6ee75 in alloc_new_sid bgpd/bgp_mplsvpn.c:712 #4 0x55d5dba6f3ce in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:758 #5 0x55d5dba6fb94 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:849 #6 0x55d5dba7f975 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:299 #7 0x55d5dba7f975 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3704 #8 0x55d5dbbb6c66 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3164 #9 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 #10 0x7f8d1713f034 in event_call lib/event.c:1974 #11 0x7f8d1708242b in frr_run lib/libfrr.c:1214 #12 0x55d5db99d19d in main bgpd/bgp_main.c:510 #13 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) Direct leak of 296 byte(s) in 1 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) #1 0x7f8d1709f238 in qcalloc lib/memory.c:105 #2 0x7f8d170b1d5f in srv6_locator_chunk_alloc lib/srv6.c:135 #3 0x55d5dbbb6a19 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3144 #4 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 #5 0x7f8d1713f034 in event_call lib/event.c:1974 #6 0x7f8d1708242b in frr_run lib/libfrr.c:1214 #7 0x55d5db99d19d in main bgpd/bgp_main.c:510 #8 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) *********************************************************************************** ``` Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-15lib: Fix free functionDonald Sharp
The list delete function on creation was set to srv6_locator_chunk_free Which takes a double pointer and dereferences it to free the data. When list_delete is called it calls the delete function like this: if (*list->del) (*list->del)(node->data); The data is not passed in by reference and as such we do not have a double pointer. Fortunately this list_delete is only really called on shutdown when the locator was deleted and we do not have a fun situation where we were suddenly freeing 'something'. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-14Merge pull request #12219 from cscarpitta/feature/srv6-usid-behavior-supportDonatas Abraitis
bgpd, zebra: Add support for SRv6 uSID Behaviors
2022-11-08lib,zebra: Add SRv6 uSID info to VTY outputCarmine Scarpitta
In this commit, we extend to print the `SRV6_LOCATOR_USID` flag. The output appears as follows: ``` { "locators":[ { "name":"loc1", "prefix":"fc00:0:1::/48", "blockBitsLength":32, "nodeBitsLength":16, "functionBitsLength":16, "argumentBitsLength":0, "uSID":true, "statusUp":true, "chunks":[ { "prefix":"fc00:0:1::/48", "proto":"bgp" } ] } ] } ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-31Merge pull request #12230 from cscarpitta/fix/replace-inet-top-in-srv6-libmobash-rasool
lib: Use `%pI6`/`%pI4` to print SRv6 seg6local ctx
2022-10-30lib: Use `%pI6`/`%pI4` to print SRv6 seg6local ctxCarmine Scarpitta
This commit changes `seg6local_context2str()` to use `%pI6`/`%pI4` instead of `inet_ntop` to print the SRv6 seg6local context information. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-29lib, bgpd: Enhance `srv6_locator_chunk_free()` APICarmine Scarpitta
A programmer can use the `srv6_locator_chunk_free()` function to free the memory allocated for a `struct srv6_locator_chunk`. The programmer invokes `srv6_locator_chunk_free()` by passing a single pointer to the `struct srv6_locator_chunk` to be freed. `srv6_locator_chunk_free()` uses `XFREE()` to free the memory. It is the responsibility of the programmer to set the `struct srv6_locator_chunk` pointer to NULL after freeing memory with `srv6_locator_chunk_free()`. This commit modifies the `srv6_locator_chunk_free()` function to take a double pointer instead of a single pointer. In this way, setting the `struct srv6_locator_chunk` pointer to NULL is no longer the programmer's responsibility but is the responsibility of `srv6_locator_chunk_free()`. This prevents programmers from making mistakes such as forgetting to set the pointer to NULL after invoking `srv6_locator_chunk_free()`. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18lib: add block/node/arg len to SRv6 locator JSONCarmine Scarpitta
This commit adds the SRv6 locator's block length, node length and argument length to the output of the command "show segment-routing srv6 locator json" Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra, lib: add support for SRv6 End.DT46 behaviorCarmine Scarpitta
This commit enables zebra to install End.DT46 nexthops into the Linux kernel. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2021-11-28zebra: Add support for json output in srv6 locator detail commandYamato Sugawara
Signed-off-by: Yamato Sugawara <yamato.sugawara@linecorp.com>
2021-11-25lib: Replace prefix2str for JSON to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-07lib: add dtor for srv6 locator chunk listMark Stapp
Add a delete function for the chunk list in an srv6 locator. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-02lib: fix json style to camel-case instead of underscoresHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: add new structures for srv6-locator (step2)Hiroki Shirokura
This commit is a part of #5853 works that add new structures for SRv6-locator. This structure will be used by zebra and another routing daemon and its ZAPI messaging to manage SRv6-locator. Encoder/decoder for ZAPI stream is also added by this commit. Real configuration mechanism isn't implemented at this commit. later commit add real configure implementation. This commit add only SRv6-locator's structures and misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: refactor func prototype seg6local_context2str (step1)Hiroki Shirokura
Make seg6local_context2str function's prototype better. This function is added on commit e496b4203, and function interface's considering wasn't enough. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2020-04-27*: fix first headerDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-01-15bgpd: prefix-sid srv6 l3vpn service tlvHiroki Shirokura
bgpd already supports BGP Prefix-SID path attribute and there are some sub-types of Prefix-SID path attribute. This commits makes bgpd to support additional sub-types. sub-Type-4 and sub-Type-5 for construct the VPNv4 SRv6 backend with vpnv4-unicast address family. This path attributes is already supported by Ciscos IOS-XR and NX-OS. Prefix-SID sub-Type-4 and sub-Type-5 is defined on following IETF-drafts. Supports(A-part-of): - https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-04 - https://tools.ietf.org/html/draft-dawra-idr-srv6-vpn-05 Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>