summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
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
2022-06-22Merge pull request #11445 from opensourcerouting/fix/replace_sockunion2strDonald Sharp
*: Replace sockunion2str => %pSU
2022-06-21lib: Add an api is_ipv6_global_unicastMobashshera Rasool
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>
2022-06-21*: Replace sockunion2str => %pSUDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-20Merge pull request #11146 from NicolasDichtel/masterIgor Ryzhov
lib/if: fix interface name comparison
2022-06-19Merge pull request #11423 from donaldsharp/lgtm_fixesDonatas Abraitis
Lgtm fixes
2022-06-17lib: Add some extra error messages for when things go wrongDonald Sharp
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>
2022-06-17bgpd: Add RFC9234 implementationEugene Bogomazov
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>
2022-06-17lib: cleanup red-herring memleaks in parent of daemonizing forkChristian Hopps
- 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>
2022-06-16Merge pull request #11419 from anlancs/fix/minor-1Donald Sharp
zebra, lib: minor changes
2022-06-16lib: Function `crypt` does not need to be declared mid functionDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-16Merge pull request #11409 from donaldsharp/zebra_nhg_debugRuss White
Zebra nhg debug
2022-06-16lib: correct two commentsanlan_cs
Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-06-15lib: stream_dup memory alloc cannot failDonald Sharp
If stream_dup calls stream_new, stream_new can never return a NULL pointer so the check is unneeded. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-14lib: Abstract usage of '%pNHs' so that nexthop groups can use it tooDonald Sharp
Abstract the usage of '%pNHs' so that when nexthop groups get a new special printfrr that it can take advantage of this functionality too. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-14Merge pull request #11395 from opensourcerouting/fix/autocompete_for_rmap_bgpDonald Sharp
*: Use autocomplete for route-maps under commands that require it
2022-06-13*: Use autocomplete for route-maps under commands that require itDonatas Abraitis
For example: ``` donatas-laptop# show bgp ipv4 unicast neighbors 127.0.0.2 advertised-routes route-map ? RMAP_NAME Name of the route map testas2 testas donatas-laptop(config)# router bgp donatas-laptop(config-router)# address-family ipv4 donatas-laptop(config-router-af)# redistribute connected route-map ? RMAP_NAME Pointer to route-map entries testas2 testas donatas-laptop(config-router-af)# network 192.168.0.0/23 route-map ? RMAP_NAME Name of the route map testas2 testas ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-13bgpd: Wrap IPV4_CLASS_DE into ipv4_unicast_valid() helperDonatas Abraitis
Linux kernel allows (FreeBSD/OpenBSD too) using reserved class E IP ranges. This is a preparation commit that ease the global switch to allow/deny class E IP ranges in FRR. https://datatracker.ietf.org/doc/html/draft-chen-ati-adaptive-ipv4-address-space Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-10lib, zebra, bgpd: Move route EVPN flag to nexthopXiao Liang
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>
2022-06-09lib: Update sysrepo code with the latest API changesDonatas Abraitis
* sr_event_notif_send -> sr_notif_send * sr_process_events -> sr_subscription_process_events * sr_oper_get_items_subscribe -> sr_oper_get_subscribe * Removed SR_SUBSCR_CTX_REUSE flag from the code at all Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-08lib: Cleanup workqueue.h to have variable declarationsDonald Sharp
Cleanup workqueue.h to have variable declarations as per our standard. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-08lib: Fixup workqueue.c to use proper thread.h semanticsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-07Merge pull request #11158 from cyberstormdotmu/masterPushpasis Sarkar
lib/md5,lib/sha256: Use explicit_bzero to clean up sensitive data.
2022-05-31lib/md5,lib/sha256: Use explicit_bzero to clean up sensitive data.Loganaden Velvindron
explicit_bzero() is available as an API to clean up sensitive data and avoid compiler optimizations that remove calls to memset() or bzero(). Signed-off-by: Loganaden Velvindron <logan@cyberstorm.mu>
2022-05-30lib/if: fix interface name comparisonNicolas Dichtel
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>
2022-05-20lib: Make thread_is_scheduled a static inlineDonald Sharp
For performance, yo. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-13Merge pull request #11195 from anlancs/fix/lib-qsortDonald Sharp
lib: add one check in "list_sort()"
2022-05-12lib: add one check in "list_sort()"anlan_cs
Add one check in `list_sort()`: Immediatly return if no any items in this list. Signed-off-by: anlan_cs <vic.lan@pica8.com>