summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: improve labelpool performance at scaleG. Paul Ziemba2022-08-311-0/+69
| | | | | | | | | | | | | | - 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>
* lib: Fix extra semicolon after ifWeiguo Li2022-08-251-2/+1
| | | | Signed-off-by: Weiguo Li <liwg06@foxmail.com>
* lib: Ensure ls_msg2edge does not use memory after freeingDonald Sharp2022-08-151-2/+3
| | | | | | | 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>
* lib: Remove invalid function declarationWeiguo Li2022-08-081-7/+0
| | | | | | there is no definition of ttable_cell_del(), thus remove its declaration. Signed-off-by: Weiguo Li <liwg06@foxmail.com>
* Merge pull request #11716 from mobash-rasool/fixes2Donald Sharp2022-08-051-2/+4
|\ | | | | pimd, pim6d: Send register msg via reg socket, solve FHR/RP same node issue
| * lib: Add errno details to the sockopt_reuseaddr apiMobashshera Rasool2022-08-041-2/+4
| | | | | | | | Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
* | Merge pull request #11710 from donaldsharp/split_up_test_multicast_pim_static_rpDonatas Abraitis2022-08-031-1/+1
|\ \ | | | | | | some test fixes and a coverity fix
| * | lib: Coverity wants strlen to include null characterDonald Sharp2022-07-291-1/+1
| |/ | | | | | | | | | | | | Ensure that the string has the null terminating character available as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | Merge pull request #11715 from Orange-OpenSource/link_stateDonald Sharp2022-08-032-4/+4
|\ \ | | | | | | lib: Correct valgrind errors
| * | lib: Correct valgrind errorsOlivier Dugeon2022-08-012-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | build: unconditionally enable format checksDavid Lamparter2022-08-021-4/+0
| | | | | | | | | | | | | | | | | | 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>
* | lib: Remove usage of inet_ntop in lib/sockopt.cDonald Sharp2022-08-021-5/+2
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | lib: Use pI4 instead of inet_ntop in sockopt.cDonald Sharp2022-07-301-5/+2
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #11657 from donaldsharp/why_timerDonatas Abraitis2022-07-222-3/+3
|\ | | | | convert thread_cancel to THREAD_OFF
| * lib, vrrpd: Use THREAD_ARGDonald Sharp2022-07-212-3/+3
| | | | | | | | | | | | | | 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>
* | *: frr_with_mutex change to follow our standardDonald Sharp2022-07-208-56/+56
|/ | | | | | | | | | | | 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>
* lib: thread pointer is already null at this pointDonald Sharp2022-07-191-1/+0
| | | | | | | | 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>
* lib: Return 0 as remaining msec if the thread is not scheduledDonatas Abraitis2022-07-181-0/+3
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* lib: Prevent Uninitialized usage of dataDonald Sharp2022-07-171-1/+1
| | | | | | Valgrind is reporting that prefix is being used uninitialized. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #11585 from patrasar/sg_strDavid Lamparter2022-07-131-1/+1
|\
| * pimd: Fix description for PIM_SG_LENSarita Patra2022-07-121-1/+1
| | | | | | | | Signed-off-by: Sarita Patra <saritap@vmware.com>
* | Merge pull request #11285 from iqras23/conditional_def_origDavid Lamparter2022-07-122-4/+12
|\ \ | |/ |/|
| * bgpd: Fix insonsistencies with default-originate route-mapIqra Siddiqui2022-07-062-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lib: check hostname in resolver_resolvekevinshen2022-07-071-0/+3
| | | | | | | | | | | | | | | | 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>
* | lib: use assume() for SA fixing, add explainerDavid Lamparter2022-07-061-2/+20
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #11534 from mjstapp/fix_typesafe_saDavid Lamparter2022-07-061-1/+2
|\ \ | |/ |/| lib: fix SA warning in typesafe code
| * lib: fix SA warning in typesafe codeMark Stapp2022-07-051-1/+2
| | | | | | | | | | | | | | 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>
* | lib: Convert ipv4_martian to boolDonatas Abraitis2022-07-011-3/+3
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | lib: Allow using IPv4 (Class E) reserved block if enabledDonatas Abraitis2022-07-012-11/+21
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | lib, vtysh: Add `allow-reserved-ranges` global commandDonatas Abraitis2022-07-012-0/+30
|/ | | | | | | 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>
* lib: Allow downgrade of all caps when none are specifiedDonald Sharp2022-06-291-8/+7
| | | | | | | | | | | | 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>
* lib: add SYS_RAWIO to the capabilities definitionsAnuradha Karuppiah2022-06-272-0/+5
| | | | Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
* Merge pull request #11426 from error2407/open_policyDonatas Abraitis2022-06-271-0/+3
|\ | | | | bgpd: Add RFC9234 implementation
| * bgpd: Add RFC9234 implementationEugene Bogomazov2022-06-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC9234 is a way to establish correct connection roles (Customer/ Provider, Peer or with RS) between bgp speakers. This patch: - Add a new configuration/terminal option to set the appropriate local role; - Add a mechanism for checking used roles, implemented by exchanging the corresponding capabilities in OPEN messages; - Add strict mode to force other party to use this feature; - Add basic support for a new transitive optional bgp attribute - OTC (Only to Customer); - Add logic for default setting OTC attribute and filtering routes with this attribute by the edge speakers, if the appropriate conditions are met; - Add two test stands to check role negotiation and route filtering during role usage. Signed-off-by: Eugene Bogomazov <eb@qrator.net>
* | lib, zebra: Notice when a nexthop is set linkdownDonald Sharp2022-06-231-0/+1
| | | | | | | | | | | | | | | | 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>
* | lib: Increase nexthop flags size to 16 bitsDonald Sharp2022-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #10629 from leonshaw/fix/mp-evpn-nhRuss White2022-06-233-2/+7
|\ \ | | | | | | lib, zebra, bgpd: Move route EVPN flag to nexthop
| * | lib, zebra, bgpd: Move route EVPN flag to nexthopXiao Liang2022-06-103-2/+7
| | | | | | | | | | | | | | | | | | | | | Multipath route may have mixed nexthops of EVPN and IP unicast. Move EVPN flag to nexthop to support such cases. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
* | | Merge pull request #11445 from opensourcerouting/fix/replace_sockunion2strDonald Sharp2022-06-221-3/+1
|\ \ \ | | | | | | | | *: Replace sockunion2str => %pSU
| * | | *: Replace sockunion2str => %pSUDonatas Abraitis2022-06-211-3/+1
| | | | | | | | | | | | | | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | | | lib: Add an api is_ipv6_global_unicastMobashshera Rasool2022-06-221-0/+9
|/ / / | | | | | | | | | | | | | | | | | | Add api is_ipv6_global_unicast to identify whether a given ipv6 address is global unicast or not. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
* | | Merge pull request #11146 from NicolasDichtel/masterIgor Ryzhov2022-06-201-2/+14
|\ \ \ | | | | | | | | lib/if: fix interface name comparison
| * | | lib/if: fix interface name comparisonNicolas Dichtel2022-05-301-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using strtol() to compare two strings is a bad idea. Before the patch, if_cmp_name_func() may confuse foo001 and foo1. PR=79407 Fixes: 106d2fd572c1 ("2003-08-01 Cougar <cougar@random.ee>") Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Tested-by: Aurélien Degeorges <aurelien.degeorges@6wind.com> Acked-by: Philippe Guibert <philippe.guibert@6wind.com>
* | | | Merge pull request #11423 from donaldsharp/lgtm_fixesDonatas Abraitis2022-06-192-2/+0
|\ \ \ \ | | | | | | | | | | Lgtm fixes
| * | | | lib: Function `crypt` does not need to be declared mid functionDonald Sharp2022-06-162-2/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | | | | lib: Add some extra error messages for when things go wrongDonald Sharp2022-06-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In sockunion.c let's eliminate the silent and unexpected failure mode to let the end operator figure out something is terribly wrong. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | | | | lib: cleanup red-herring memleaks in parent of daemonizing forkChristian Hopps2022-06-171-0/+2
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The parent of the daemonizing fork reports memleaks for the early northbound allocations (libyang). If these were real memleaks these would show up in the child as well; however, ignoring all memleaks in the parent of the fork is too hard a sale. Instead, spend some CPU cycles cleaning up the allocations in the parent after the fork and immeidatley prior to exiting the parent after the daemonizing fork. Signed-off-by: Christian Hopps <chopps@labn.net>
* | | | Merge pull request #11419 from anlancs/fix/minor-1Donald Sharp2022-06-162-2/+2
|\ \ \ \ | |/ / / |/| | | zebra, lib: minor changes
| * | | lib: correct two commentsanlan_cs2022-06-162-2/+2
| | | | | | | | | | | | | | | | Signed-off-by: anlan_cs <vic.lan@pica8.com>
* | | | Merge pull request #11409 from donaldsharp/zebra_nhg_debugRuss White2022-06-162-21/+30
|\ \ \ \ | | | | | | | | | | Zebra nhg debug