summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-09-26lib: Fix `show route-map NAME json` command and memory leakDonatas Abraitis
JSON object was generated, but not printed, because the function returned immediatelly, even without freeing the memory. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-22bgpd: Use %pRD for prefix_rd2str()Donatas Abraitis
Convert a bunch of prefix_rd2str() for json/vty stuff. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-14lib: Fix skip of every other plist deletionDonald Sharp
When bulk deleting prefix lists on shutdown the code was calling plist_delete, which removed the item from the master->str list, and then popping the next item on the list and just dropping it on the floor. The pop is not needed. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-09-13Merge pull request #11899 from ↵Russ White
opensourcerouting/feature/route_validation_extended_community bgpd: Implement Origin Validation State via extended communities
2022-09-12Merge pull request #11868 from LabNConsulting/ziemba/bgp-labelpool-performanceDonald Sharp
bgpd: improve labelpool performance at scale
2022-09-12lib: Replace route_map_clear_updated to voidDonatas Abraitis
Return status not used at all. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-07lib: replace one path with macroanlan_cs
Replace all of the path name with macro, only the two places. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-09-06Merge pull request #11823 from pguibert6WIND/bgp_vpnv4_gre_ebgpRafael Zalamena
Bgp vpnv4 convey without transport label
2022-09-05bgpd: add resolution for l3vpn traffic over gre interfacesPhilippe Guibert
When a route imported from l3vpn is analysed, the nexthop from default VRF is looked up against a valid MPLS path. Generally, this is done on backbones with a MPLS signalisation transport layer like LDP. Generally, the BGP connection is multiple hops away. That scenario is already working. There is case where it is possible to run L3VPN over GRE interfaces, and where there is no LSP path over that GRE interface: GRE is just here to tunnel MPLS traffic. On that case, the nexthop given in the path does not have MPLS path, but should be authorized to convey MPLS traffic provided that the user permits it via a configuration command. That commit introduces a new command that can be activated in route-map: > set l3vpn next-hop encapsulation gre That command authorizes the nexthop tracking engine to accept paths that o have a GRE interface as output, independently of the presence of an LSP path or not. A configuration example is given below. When bgp incoming vpnv4 updates are received, the nexthop of NLRI is 192.168.0.2. Based on nexthop tracking service from zebra, BGP knows that the output interface to reach 192.168.0.2 is r1-gre0. Because that interface is not MPLS based, but is a GRE tunnel, then the update will be using that nexthop to be installed. interface r1-gre0 ip address 192.168.0.1/24 exit router bgp 65500 bgp router-id 1.1.1.1 neighbor 192.168.0.2 remote-as 65500 ! address-family ipv4 unicast no neighbor 192.168.0.2 activate exit-address-family ! address-family ipv4 vpn neighbor 192.168.0.2 activate neighbor 192.168.0.2 route-map rmap in exit-address-family exit ! router bgp 65500 vrf vrf1 bgp router-id 1.1.1.1 no bgp network import-check ! address-family ipv4 unicast network 10.201.0.0/24 redistribute connected label vpn export 101 rd vpn export 444:1 rt vpn both 52:100 export vpn import vpn exit-address-family exit ! route-map rmap permit 1 set l3vpn next-hop encapsulation gre exit Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-04bgpd: Handle Origin Validation State extended community via route-map matchDonatas Abraitis
Add an ability to match via route-maps. An additional route-map command `match rpki-extcommunity <invalid|notfound|valid>` added. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-02Merge pull request #11884 from mjstapp/fix_cancel_ptrsDonatas Abraitis
lib: ensure locals are inited to NULL
2022-08-31lib: ensure locals are inited to NULLMark Stapp
A couple of pointers in do_thread_cancel() we only inited at the start of the function; make sure they're inited during each iteration of the loop. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-08-31bgpd: improve labelpool performance at scaleG. Paul Ziemba
- double the size of each new chunk request from zebra - use bitfields to track label allocations in a chunk - When allocating: - skip chunks with no free labels - search biggest chunks first - start search in chunk where last search ended - Improve API documentation in comments (bgp_lp_get() and callback) - Tweak formatting of "show bgp labelpool chunks" - Add test features (compiled conditionally on BGP_LABELPOOL_ENABLE_TESTS) Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2022-08-29Merge pull request #11855 from cscarpitta/fix-srv6-memleaksDonatas Abraitis
*: Fix several memory leaks in SRv6 implementation
2022-08-25lib: Fix extra semicolon after ifWeiguo Li
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
2022-08-24lib: Fix memory leak in `zclient_send_localsid()`Carmine Scarpitta
Running `bgp_srv6l3vpn_to_bgp_vrf` and `bgp_srv6l3vpn_to_bgp_vrf2` topotests with `--valgrind-memleaks` gives several memory leak errors. This is due to the way FRR daemons pass local SIDs to zebra: to send a local SID to zebra, FRR daemons call the `zclient_send_localsid()` function. The `zclient_send_localsid()` function performs the following sequence of operations: * create a temporary `struct nexthop`; * call `nexthop_add_srv6_seg6local()` to fill the `struct nexthop` with the proper local SID information; * create a `struct zapi_route` and call `zapi_nexthop_from_nexthop()` to copy the information from the `struct nexthop` to the `struct zapi_route`; * send the `struct zapi_route` to zebra through the ZAPI. The `nexthop_add_srv6_seg6local()` function uses `XCALLOC()` to allocate memory for the SRv6 nexthop. This memory is never freed. Creating a temporary `struct nexthop` is unnecessary, as the local SID information can be pushed directly to the `struct zapi_route`. This patch simplifies the implementation of `zclient_send_localsid()` by avoiding using the temporary `struct nexthop`. This eliminates the need to use `nexthop_add_srv6_seg6local()` to fill the `struct nexthop` and consequently fixes the memory leak. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-08-15lib: Ensure ls_msg2edge does not use memory after freeingDonald Sharp
ls_msg2edge calls ls_edge_del_all which will free the edge variable. Ensure that FRR properly returns NULL. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-08lib: Remove invalid function declarationWeiguo Li
there is no definition of ttable_cell_del(), thus remove its declaration. Signed-off-by: Weiguo Li <liwg06@foxmail.com>
2022-08-04Merge pull request #11716 from mobash-rasool/fixes2Donald Sharp
pimd, pim6d: Send register msg via reg socket, solve FHR/RP same node issue
2022-08-04lib: Add errno details to the sockopt_reuseaddr apiMobashshera Rasool
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-08-03Merge pull request #11710 from donaldsharp/split_up_test_multicast_pim_static_rpDonatas Abraitis
some test fixes and a coverity fix
2022-08-02Merge pull request #11715 from Orange-OpenSource/link_stateDonald Sharp
lib: Correct valgrind errors
2022-08-02build: unconditionally enable format checksDavid Lamparter
The format message checks done by clippy/xrelfo were still guarded behind `--enable-dev-build`. They've been clean and reliable, so it's time to enable them unconditionally. Fixes: #11680 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-08-02lib: Remove usage of inet_ntop in lib/sockopt.cDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-01lib: Correct valgrind errorsOlivier Dugeon
In CSPF topo test, valgrind detects uninitialized bytes when exporting TE Opaque information through ZEBRA. This is due to C pragma compilation directive __attribute__(aligned(8)) in struct ls_node_id in link_state.h. Valgrind consideris that struct ls_node_id nid = {} doesn't initialized the padding bytes introduced by gcc. This patch simply removes the C pragma compilation directive and also takes opportunity to remove the transmission of remote node id for vertices and subnets which is not known. Indeed, remote node id is only pertinent for edges. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2022-07-29lib: Use pI4 instead of inet_ntop in sockopt.cDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-29lib: Coverity wants strlen to include null characterDonald Sharp
Ensure that the string has the null terminating character available as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22Merge pull request #11657 from donaldsharp/why_timerDonatas Abraitis
convert thread_cancel to THREAD_OFF
2022-07-21lib, vrrpd: Use THREAD_ARGDonald Sharp
Don't auto set the thread->arg pointer. It is private and should be only accessed through the THREAD_ARG pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-20*: frr_with_mutex change to follow our standardDonald Sharp
convert: frr_with_mutex(..) to: frr_with_mutex (..) To make all our code agree with what clang-format is going to produce Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-19lib: thread pointer is already null at this pointDonald Sharp
in agentx_events_update the timeout_thr is canceled on line 88 just above. This already sets the pointer to NULL. No need to do this again. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-18lib: Return 0 as remaining msec if the thread is not scheduledDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-16lib: Prevent Uninitialized usage of dataDonald Sharp
Valgrind is reporting that prefix is being used uninitialized. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-13Merge pull request #11585 from patrasar/sg_strDavid Lamparter
2022-07-12Merge pull request #11285 from iqras23/conditional_def_origDavid Lamparter
2022-07-12pimd: Fix description for PIM_SG_LENSarita Patra
Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-07-07lib: check hostname in resolver_resolvekevinshen
resolver_resolve should check hostname is null or not. if ares_gethostbyname() get null hostname string, the hostname string will access a null pointer and crash. Signed-off-by: kevinshen <kevinshen@inspur.com>
2022-07-06bgpd: Fix insonsistencies with default-originate route-mapIqra Siddiqui
Description: - When there are multiple policies configured with route-map then the first matching policy is not getting applied on default route originated with default-originate. - In BGP we first run through the BGP RIB and then pass it to the route-map to find if its permit or deny. Due to this behaviour the first route in BGP RIB that passes the route-map will be applied. Fix: - Passing extra parameter to routemap_apply so that we can get the preference of the matching policy, keep comparing it with the old preference and finally consider the policy with less preference. Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2022-07-06lib: use assume() for SA fixing, add explainerDavid Lamparter
Literally 4 minutes after hitting merge on Mark's previous fix for this I remembered we have an `assume()` macro in compiler.h which seems like the right tool for this. (... and if I'm touching it, I might as well add a little text explaining what's going on here.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-06Merge pull request #11534 from mjstapp/fix_typesafe_saDavid Lamparter
lib: fix SA warning in typesafe code
2022-07-05lib: fix SA warning in typesafe codeMark Stapp
There's a nagging SA warning, at least with the scan-build version we use in the FRR CI. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-07-01lib: Convert ipv4_martian to boolDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-01lib: Allow using IPv4 (Class E) reserved block if enabledDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-01lib, vtysh: Add `allow-reserved-ranges` global commandDonatas Abraitis
It will be used to allow/deny using IPv4 reserved ranges (Class E) for Zebra (configuring interface address) or BGP (allow next-hop to be from this range). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-29lib: Allow downgrade of all caps when none are specifiedDonald Sharp
Staticd when run tells privs.c that it does not need any priviledges. The lib/privs.c code was not downgrading any and all permissions it may have been given at startup. Since we don't need any let's actually tell the system that FRR does not need the capabilities anymore in the case where a daemon does not ask for any cap's. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-27lib: add SYS_RAWIO to the capabilities definitionsAnuradha Karuppiah
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-06-27Merge pull request #11426 from error2407/open_policyDonatas Abraitis
bgpd: Add RFC9234 implementation
2022-06-23lib, zebra: Notice when a nexthop is set linkdownDonald Sharp
When a nexthop is set RTNH_F_LINKDOWN, start noticing that this flag is set. Allow FRR to know about this flag but at this point do not do anything with it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-23lib: Increase nexthop flags size to 16 bitsDonald Sharp
commit: 5609e70fb87a3b23b55629a33e5afb298974c142 Added a new flag to the `struct nexthop` and this addition of a flag caused the flags size to be too small. Increase the size of flags to allow more flags to be had. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-23Merge pull request #10629 from leonshaw/fix/mp-evpn-nhRuss White
lib, zebra, bgpd: Move route EVPN flag to nexthop