summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2023-10-08Merge pull request #10733 from anlancs/zebra-remove-updateRafael Zalamena
zebra: remove ZEBRA_INTERFACE_VRF_UPDATE
2023-10-07*: remove ZEBRA_INTERFACE_VRF_UPDATEanlan_cs
Currently when one interface changes its VRF, zebra will send these messages to all daemons in *order*: 1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF ) 2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF ) 3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF ) When daemons deal with `VRF_UPDATE`, they use `zebra_interface_vrf_update_read()->if_lookup_by_name()` to check the interface exist or not in old VRF. This check will always return *NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't find this interface in old VRF. Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough, they will deal with RB tree, so don't send this `VRF_UPDATE` message when vrf changes. Since all daemons have good mechanism to deal with changing vrf, and don't use this `VRF_UPDATE` mechanism. So, it is safe to completely remove all the code with `VRF_UPDATE`. Signed-off-by: anlan_cs <anlan_cs@tom.com>
2023-10-03Merge pull request #14472 from opensourcerouting/plist-dupRuss White
lib: fix route map duplicated prefix removal evaluation
2023-10-03Merge pull request #13814 from pguibert6WIND/comm_list_expanded_match_no_exactRuss White
bgpd: add match community "any" to match any incoming community
2023-10-03Merge pull request #14508 from LabNConsulting/chopps/darr-use-frrmemfuncDonatas Abraitis
lib: use XREALLOC over realloc avoid coverity warning
2023-10-02bgpd: add 'match community-list any' functionPhilippe Guibert
There is no match mechanism to match one community from the incoming community-list. Add the 'any' keyword to the 'match route-map' command of communit-list and large-community-list. > match community-list AAA any > match large-community-list AAA any Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-09-29*: Do not cast to the same type as the destination isDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-29lib: use XREALLOC over realloc avoid coverity warningChristian Hopps
I believe coverity is complaining that the current code does not handle the realloc fail case, in which case the original pointer is not freed, but NULL is returned. The code assert()s it's not failed but that is not strong enough it needs to abort which XREALLOC does and is a better integration into FRR-inrfa anyway. Signed-off-by: Christian Hopps <chopps@labn.net>
2023-09-28Merge pull request #14498 from idryzhov/fix-conf-t-file-lockDonatas Abraitis
Fixes for `file-lock` mode of configuration node
2023-09-28vty: fix working in file-lock modeIgor Ryzhov
When the configuration node is entered in file-lock mode, candidate and running datastores are locked. Any configuration change is followed by an implicit commit which leads to a crash of mgmtd, because double lock is prohibited by an assert. When working in file-lock mode, we shouldn't do implicit commits which is disabled by allowing pending configuration changes. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-09-27vty: fix configure terminal argument descriptionsIgor Ryzhov
"terminal" and "file-lock" description are mixed up. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-09-27Merge pull request #14482 from opensourcerouting/fix/walltime_threshold_disableDonald Sharp
lib: Drop deprecated enable-time-check, enable-cpu-time compile options
2023-09-26Merge pull request #12649 from louis-6wind/bgp-link-stateRuss White
bgpd: add basic support of BGP Link-State RFC7752
2023-09-24lib: assert for VTY_PASSFD expectationsDavid Lamparter
Coverity is complaining that vty->state could be VTY_PASSFD here. It can't, it really shouldn't, and if it actually is then something went seriously wrong somewhere earlier so assert()ing out is the best thing to do. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-24lib: Drop deprecated enable-time-check, enable-cpu-time compile optionsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-22lib: don't announce prefix delete for duplicatesRafael Zalamena
When deleting a duplicated prefix list entry don't announce the change to route map listeners, otherwise they will be removing rules that shouldn't be removed causing the prefix that still exist in the prefix-list to be not evaluated anymore. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-09-22Revert "lib : fix duplicate prefix list delete"Rafael Zalamena
This reverts commit 394ed767e7207805a6d916b01b1f1d4743c03dd1.
2023-09-21Merge pull request #14454 from opensourcerouting/coverity-20230920Donald Sharp
lib: fix a bunch of coverity nits
2023-09-20lib: random make-coverity-happy nitsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-20lib: adapt nexthop_cmp to handle multiple segs SIDsDmytro Shytyi
Extend nexthop_cmp function to process multiple segs SIDs. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20lib: update del_srv6_seg6_local to handle seg6_segsDmytro Shytyi
Adapt de_srv6_seg6local to handle seg6_segs structure. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20lib: nexthop, free the multiple seg6_segsDmytro Shytyi
Adapt the function that fees srv6 nexthop to handle multiple segs. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20lib: in nexthop adaptation pass the number of segs to jhashDmytro Shytyi
Adapt nexthop file to handle hash of multiple segments Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthopDmytro Shytyi
Append zebra and lib to use muliple SRv6 segs SIDs, and keep one seg SID for bgpd and sharpd. Note: bgpd and sharpd compilation relies on the lib and zebra files, i.e if we separate this: lib or zebra or bgpd or sharpd in different commits - this will not compile. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20lib: clippy ELF: check existence of string tableDavid Lamparter
Mostly to make coverity happy, no compiler/linker should produce broken ELF files like this (and if it does we can't process it anyway...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-20lib: straight return on error on log open failDavid Lamparter
I think I originally had some other code at the tail end of that function, but that's not the case anymore, and dropping out of the function with a straight "return -1" is more useful than trucking on with an invalid fd. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-20lib: add dup() error check in logging codeDavid Lamparter
Mostly to make coverity happy, if dup() fails we're f*cked already. (Still useful to have a better error message...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-19lib: constrain hash table "tabshift" both waysDavid Lamparter
The previous change to assume() did address the coverity warning about one direction of the shift in HASH_KEY, let's constrain the other in HASH_SIZE as well. To be fair, the hash table *will* break at 1G entries, but at that point we have other problems RAM-wise. (Could bump the thing to 64-bit, but then we need better item hash functions too on every single user.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-18bgpd, lib: extend the size of the prefix string bufferLouis Scalbert
BGP Link-State prefixes are special prefixes that contains a lot of data. Extend the length of the prefix string buffer in order to display properly this type of prefixes with the next commits. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18bgpd: store bgp link-state prefixesLouis Scalbert
Add the ability to store link-state prefixes in the BGP table. Store a raw copy of the BGP link state NLRI TLVs as received in the packet in 'p.u.prefix_linkstate.ptr'. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18lib: add link-state prefixesLouis Scalbert
Add to the library the link-state type of prefixes. Link-state prefixes contain much more data than the current prefixes and they only make sense for BGP Link-State. Storing all the data in "struct prefix" is not relevant because it would increase the memory usage of all daemons. Instead a pointer to a structure that contains all the information is used. Printing link-state prefixes can be delegated to a hook function. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18bgpd: add bgp link-state address-family configuration contextLouis Scalbert
Add the bgp link-state configuration context cli: > router bgp 65001 > address-family link-state link-state > neighbor 192.0.2.2 activate > exit-address-family Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18lib: register bgp link-state afi/safiLouis Scalbert
Register BGP Link-State AFI/SAFI values from RFC7752. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-09-14lib: another attempt at Coverity false positivesDavid Lamparter
Typesafe hash tables do this: assume((tabshift) >= 2 && (tabshift) <= 33); (val) >> (33 - (tabshift)); Sadly, Coverity currently ignores assume() and says: [...] right shifting by more than 31 bits has undefined behavior. The shift amount, "33 - h->hh.tabshift", is 33. Let's see if Coverity understands this can't happen... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-12Merge pull request #14365 from opensourcerouting/typesafe-const-declutterMark Stapp
Revert "lib: add a frr_each_const macro"
2023-09-12Merge pull request #13724 from cscarpitta/feature/isisd-srv6-supportRuss White
isisd: Add support for SRv6 uSID (RFC 9352)
2023-09-11lib: Add CLI node for SRv6 Node MSDCarmine Scarpitta
Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11lib: Define default values for SRv6 flavors attrsCarmine Scarpitta
When installing a local SID in the Linux kernel, `lcblock_len` and `lcnode_fn_len` Netlink attributes are optional. When omitted, the kernel uses the default values: lcblock_len=32 and lcnode_fn_len=16. Let's use the same default values in FRR. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11lib: Add SRv6 flavors manipulation macrosCarmine Scarpitta
`struct seg6local_context` contains a `struct seg6local_flavors_info` that carries SRv6 flavors information. The `seg6local_flavors_info` data structure contains a field `flv_ops` that indicates which flavors are enabled for the `seg6local` nexthop. `flv_ops` is a bit-map where each bit indicates if a particular SRv6 flavor is enabled (bit set to 1) or not (bit set to 0). This commit defines some macros that can be used to manipulate the SRv6 flavors bit-map: * CHECK_SRV6_FLV_OP(OPS,OP) - check if a particular flavor is enabled; * SET_SRV6_FLV_OP(OPS,OP) - enable a particular flavor (OP); * UNSET_SRV6_FLV_OP(OPS,OP) - disable a particular flavor (OP); * RESET_SRV6_FLV_OP(OPS) - disable all SRv6 flavors. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11lib: Add SRv6 flavors info to `seg6local` nexthopCarmine Scarpitta
The RFC 8986 defines the SRv6 Network Programming concept and specifies the base set of SRv6 behaviors that enables the creation of interoperable overlays with underlay optimization. In addition, the RFC 8986 introduces the concept of "flavors", additional operations that can modify or extend the existing SRv6 behaviors. In the Linux kernel and in FRR, an SRv6 SID is implemented as a route associated with a `seg6local` nexthop. A `seg6local` nexthop represents an SRv6 behavior bound to a SID. The Linux kernel already supports the ability to add a set of flavors to a `seg6local` nexthop to modify or extend the associated behavior. This commit aligns the `seg6local` nexthop implementation of FRR to the Linux kernel. It extends the `seg6local` nexthop implementation by adding a struct `seg6local_flavors_info` that encodes the SRv6 flavors information. Currently, the `seg6local_flavors_info` data structure has three members: - `tlv_ops` indicates which flavors are enabled for the `seg6local` nexthop; - `lcblock_len`is the length of the Locator-Block part of the SID; - `lcnode_func_len` is the length of the combined Node and Function parts of the SID. `lcblock_len` and `lcnode_func_len` define the SID structure. They are required for some behaviors (e.g. NEXT-C-SID and REPLACE-C-SID). For other flavors (e.g. PSP, USP, USD) these parameters are not required and can be omitted. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11lib: Add new enum for seg6local flavor operationsCarmine Scarpitta
The RFC 8986 defines the SRv6 Network Programming concept and specifies the base set of SRv6 behaviors that enables the creation of interoperable overlays with underlay optimization. In addition, the RFC 8986 introduces the concept of "flavors", additional operations that can modify or extend the existing SRv6 behaviors. This commit adds a new enum type `seg6local_flavor_op` to represent the SRv6 flavors operations. Currently we define the following flavor operations: - PSP (defined in RFC 8986 section #4.16.1) - USP (defined in RFC 8986 section #4.16.2) - USD (defined in RFC 8986 section #4.16.3) - NEXT-C-SID (defined in draft-ietf-spring-srv6-srh-compression-03 #4.1) Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11lib: Add SRv6 behavior codepoints needed for IS-ISCarmine Scarpitta
Add more SRv6 endpoint behaviors that are required for implementing IS-IS SRv6 extensions (RFC 9352). Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11Merge pull request #14364 from ↵Donald Sharp
opensourcerouting/event-fix-delete-during-hash_iterate lib: fix delete during hash_iterate() in event_*
2023-09-08lib: fixup prefix.h to our standardsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-07lib: fix delete during hash_iterate() in event_*David Lamparter
... by converting the hash table to a typesafe hash. Honestly I was just looking around for things to convert to the typesafe hash table code, but then I noticed that cpu_record_clear() deletes items from inside the hash_iterate() callback :( Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-07lib: add inline comment about _const iterationDavid Lamparter
This is noted in doc/developer/lists.rst, but judging by the previous commit that's not where people look for this thing. Let's try a comment in the header file. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-07Revert "lib: add a frr_each_const macro"David Lamparter
This reverts commit 72eae2c3cb771b7010f3f07b6c638e9ae078bbdf. `frr_each_const(X, ...)` is not needed since it is the same as `frr_each(X_const, ...)`. The fact that it wasn't properly set up for clang-format, and that then work-arounded with "clang-format off" is all the more reason to not do this. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-06Merge pull request #14344 from opensourcerouting/freebsd-printf-sync-20230903Donald Sharp
lib/printf: sync with FreeBSD for ISO C23 enhancements
2023-09-03lib/printf: update READMEDavid Lamparter
Make a note that `%b` was picked up. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-03lib/printf: Implement N2630.Dag-Erling Smørgrav
This adds formatted input/output of binary integer numbers to the printf(), scanf(), and strtol() families, including their wide-character counterparts. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41511 FRR changes only include printf(), scanf/strtol are not locally implemented in FRR. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from FreeBSD commit d9dc1603d6e48cca84cad3ebe859129131b8387c)