summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: fix coverity use after free issue: CID 1620101Christian Hopps9 days1-0/+1
| | | | | | | The code doesn't push more than one group (currently) so wouldn't hit the bug yet, nice catch by coverity. Signed-off-by: Christian Hopps <chopps@labn.net>
* Merge pull request #16894 from wenwang00/project-phoenixwing-ysjPhilippe Guibert10 days2-0/+39
|\ | | | | staticd: Add support for SRv6 Static SIDs
| * lib: Add CLI node for SRv6 static SIDsYuqing Zhao12 days1-0/+1
| | | | | | | | Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
| * lib, isisd: Move DEFAULT_SRV6_IFNAME to global srv6.h headerYuqing Zhao12 days1-0/+2
| | | | | | | | | | | | | | This commit moves DEFAULT_SRV6_IFNAME from isis_srv6.h to srv6.h because there are other daemons that might want to use it (e.g. staticd). Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
| * lib: Add a function to print SRv6 Endpoint Behavior CodepointsYuqing Zhao12 days1-0/+36
| | | | | | | | Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
* | lib: fix dnode_create to use correct libyang function.Christian Hopps12 days1-7/+18
| | | | | | | | | | | | | | | | | | | | | | The previous use of `lyd_new_path()` returns the first node created, rather than the xpath target node. The code is lucky in the sense that it is normally only creating a single node rather than a branch. Fix this to use `lyd_new_path2()` which returns the target node to actually implement the semantics expected by callers of `dnode_create()` (i.e., returning the newly created target node). Signed-off-by: Christian Hopps <chopps@labn.net>
* | lib: improve error handling for datastore notificationsChristian Hopps12 days1-61/+87
| | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | lib: mgmt_be_client handles datastore notification using CBsChristian Hopps12 days3-11/+39
| | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | lib: yang: add yang_parse_data functionChristian Hopps12 days2-0/+73
|/ | | | | | | | This is similar to notify and RPC parsers, but this is for normal datastore data. This is initially used in handling datastore notifications being sent to another backend client[s]. Signed-off-by: Christian Hopps <chopps@labn.net>
* Merge pull request #17836 from pguibert6WIND/limit_comm_list_countDonatas Abraitis13 days2-0/+5
|\ | | | | limit community list count
| * bgpd: add 'match community-count' command to restrict comm countPhilippe Guibert2025-01-142-0/+5
| | | | | | | | | | | | | | Add a mechanism in route-map to filter out route-map which have a list of communities greater than the given number. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | lib: introduce global -w option for VRF netns backendIgor Ryzhov2025-01-151-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current -n option is only for zebra and mgmtd. All other daemons receive the VRF backend configuration from zebra upon connection to it. This leads to a potential race condition - daemons need to know the backend before they start reading their config, but they can be not connected to zebra yet at this point. As the VRF backend cannot change during runtime, let's introduce a new global -w option for setting netns backend, to make sure that all daemons know their VRF backend immediately after start. The reason for introducing a new option instead of making -n global is that ospfd already uses -n for another purposes. Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
* | lib, zebra: move ns context intialization to zebraIgor Ryzhov2025-01-151-9/+0
| | | | | | | | | | | | | | | | | | vrf->ns_ctxt is only ever used in zebra, so move its initialization to zebra's callback. Ideally this pointer shouldn't even be a part of library's vrf struct, and moved to zebra-specific struct, but this is the first step. Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
* | lib: remove VRF_BACKEND_UNKNOWNIgor Ryzhov2025-01-153-9/+1
| | | | | | | | | | | | | | | | The backend type cannot be unknown. It is configured to VRF_LITE by default in zebra anyway, so just init to VRF_LITE in the lib and remove the UNKNOWN type. Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
* | lib: northbound/mgmtd: add backend model supportChristian Hopps2025-01-145-14/+291
| | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | Merge pull request #17796 from LabNConsulting/chopps/datastore-notificationsDonald Sharp2025-01-1415-20/+1170
|\ \ | | | | | | operational-state (datastore) change notifications
| * | lib: fix new (incorrect) CLANG SA warningsChristian Hopps2025-01-142-10/+11
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
| * | mgmtd: add notify selectors to filter datastore notificationsChristian Hopps2025-01-145-3/+49
| | | | | | | | | | | | | | | | | | - Additionally push the selectors down to the backends Signed-off-by: Christian Hopps <chopps@labn.net>
| * | lib: notify on datastore (oper-state) changesChristian Hopps2025-01-144-3/+540
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
| * | lib: if: track oper-state inlineChristian Hopps2025-01-142-4/+134
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
| * | lib: vrf: track oper-state inlineChristian Hopps2025-01-142-3/+48
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
| * | lib: northbound: add basic oper-state update functionsChristian Hopps2025-01-146-0/+391
| |/ | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* / lib: Adopt Lua stuff for Lua 5.4Donatas Abraitis2025-01-131-0/+2
|/ | | | | | | | | lua_pcall() returns LUA_ERRGCMM in 5.3 which is already deprecated. The constant LUA_ERRGCMM was removed. Errors in finalizers are never propagated; instead, they generate a warning. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* Merge pull request #17807 from louis-6wind/fix-bgp-orf-crashDonatas Abraitis2025-01-091-6/+2
|\ | | | | bgpd: fix crash in displaying json orf prefix-list
| * bgpd: fix crash in displaying json orf prefix-listLouis Scalbert2025-01-091-1/+2
| | | | | | | | | | | | | | | | bgpd crashes when there is several entries in the prefix-list. No backtrace is provided because the issue was catched from a code review. Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * bgpd: fix bgp orf prefix-list json prefixLouis Scalbert2025-01-091-6/+1
| | | | | | | | | | | | | | 0x<address>FX was displayed instead of the prefix. Fixes: b219dda129 ("lib: Convert usage of strings to %pFX and %pRN") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | lib: remove interface dead codeLouis Scalbert2025-01-091-41/+0
|/ | | | | | Remove interface dead code. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* Merge pull request #17798 from mjstapp/fix_remove_clear_threadJafar Al-Gharaibeh2025-01-091-12/+0
|\ | | | | libs: remove deprecated 'clear thread' cli
| * libs: remove deprecated 'clear thread' cliMark Stapp2025-01-081-12/+0
| | | | | | | | | | | | Remove a deprecated 'clear thread cpu' command. Signed-off-by: Mark Stapp <mjs@cisco.com>
* | lib: Fix privs syscaps (pset_t) allocationMartin Buck2025-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't over-allocate syscaps in zcaps2sys(): This is just a single struct (pset_t) with a count and a pointer to an array of capabilities, not an array. So only allocate a single pset_t, not num copies of it. The allocation size of syscaps->caps then needs to be based on the number of Linux capabilities (count), but that is already handled properly a few lines below. Note that this fix is mostly cosmetic and for correctness. There was no potential for memory corruption, because num is guaranteed to be nonzero. So at least the one required pset_t was always allocated (but potentially much more). Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
* | Merge pull request #17772 from LabNConsulting/chopps/fix-oper-walkDonald Sharp2025-01-073-33/+37
|\ \ | | | | | | improve error handling of operational state walk callback
| * | lib: change and improve walk finish callback function APIChristian Hopps2025-01-063-33/+37
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* | | Merge pull request #17781 from LabNConsulting/chopps/fix-keyless-list-queryDonald Sharp2025-01-071-43/+113
|\ \ \ | | | | | | | | fix xpath query on keyless list with positional predicate
| * | | lib: northbound oper: fix keyless position predicate queriesChristian Hopps2025-01-071-43/+113
| |/ / | | | | | | | | | | | | | | | - i.e., `show /foos/foo[1]` Signed-off-by: Christian Hopps <chopps@labn.net>
* | | Merge pull request #17782 from LabNConsulting/chopps/new-notify-msg-fmtDonald Sharp2025-01-073-22/+99
|\ \ \ | | | | | | | | New YANG notify msg fmt
| * | | lib: add impl of NOTIF message ops (notif, replace, delete, patch)Christian Hopps2025-01-071-19/+73
| | | | | | | | | | | | | | | | | | | | | | | | - needed for supporting backend datastore notifications Signed-off-by: Christian Hopps <chopps@labn.net>
| * | | lib: add NOTIF message ops (notification, replace, delete, patch)Christian Hopps2025-01-072-3/+26
| |/ / | | | | | | | | | | | | | | | - needed for supporting backend datastore notifications Signed-off-by: Christian Hopps <chopps@labn.net>
* | | Merge pull request #17783 from LabNConsulting/chopps/new-oper-get-callbackDonald Sharp2025-01-074-77/+108
|\ \ \ | |_|/ |/| | Add new oper state get callback
| * | lib: if.c use new get() oper callbackChristian Hopps2025-01-071-59/+59
| | | | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>
| * | lib: northbound: add new get() callback to add lyd_node direcltyChristian Hopps2025-01-073-18/+49
| |/ | | | | | | | | | | | | | | This allows eliminating the superfluous yang_data object (which is getting created used to call lyd_new_term then deleted). Instead just call lyd_new_term() in the callback directly. Signed-off-by: Christian Hopps <chopps@labn.net>
* | Merge pull request #17474 from sougata-github-nvidia/rib_ip_protocol_cleanupRuss White2025-01-071-1/+1
|\ \ | |/ |/| zebra: Fix ip protocol route-map issue.
| * zebra: Fix ip protocol route-map issue.Sougata Barik2025-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | "ip/ipv6 protocol any route-map <route map>" cli is setting wrong route type ( ZEBRA_ROUTE_MAX ), It should set route type ZEBRA_ROUTE_ALL. Ticket: #4101560 Signed-off-by: Sougata Barik <sougatab@nvidia.com>
* | Merge pull request #17684 from opensourcerouting/fix/json_time_no_newlineJafar Al-Gharaibeh2024-12-221-0/+16
|\ \ | | | | | | bgpd, lib: Use frrstr_time() when using ctime_r()
| * | lib: Add a wrapper for time_to_string() to print time in JSON outputsDonatas Abraitis2024-12-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | newline is not expected to be printed in JSON outputs, e.g.: ``` "lastUpdate":{"epoch":1734490463,"string":"Wed Dec 18 04:54:23 2024\n" ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | | Merge pull request #17672 from raja-rajasekar/rajasekarr/batch_huge_cfgJafar Al-Gharaibeh2024-12-203-1/+16
|\ \ \ | | | | | | | | lib: Fix to optimize the time taken while batching huge configs
| * | | lib: Fix to optimize the time taken while batching huge configsRajasekar Raja2024-12-183-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: When the incoming config has say 30K entries of a prefix-lists, current implementation is to schedule the configs to be batched and only after batching the entire config, the processing of the configs take place. As part of batching this config, we perform string concatenation to save all the configs in the buffer which over time results in taking longer time. Ex: Imagine each line of config is 50 chars. With a delimiter of ‘- ‘ we end up adding 52 chars to buffer for each command i.e. 52*30000 = 156K of chars. Strlcat is an expensive operation and every time we strlcat, we have to traverse at end of string to append new char. Because of this, we end up adding extra 6-8 secs for accepting the config. Fix: The idea here is to bring back something similar to the backoff count implemented as part of 20e9a402 (lib: introduce configuration back-off timer for YANG-modeled commands). Essentially we keep a cap of 5000 per batch. So once 5000k config commands are batched, we process them, clear the buffer, set the count to 0 and then continue processing the rest of the config. option1 file has 30K entries of prefix-list Without Fix: root@mlx-3700-20:mgmt:/var/log/raja/frr# time sudo vtysh -f option1 <SNIP>.............. Waiting for children to finish applying config... [25191|staticd] done [25189|watchfrr] done [25178|ospfd] done [25190|pbrd] done [25181|bgpd] done [25175|zebra] done real 0m20.123s user 0m9.384s sys 0m2.403s With Fix: root@mlx-3700-20:mgmt:/var/log/raja/frr# time sudo vtysh -f option1 <SNIP>.............. Waiting for children to finish applying config... [19887|staticd] done [19885|watchfrr] done [19886|pbrd] done [19874|ospfd] done [19877|bgpd] done [19871|zebra] done real 0m12.168s user 0m7.511s sys 0m1.981s Issue: 3589101 Ticket# 3589101 Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
* | | | Merge pull request #17648 from LabNConsulting/fix-darr-sprintfMark Stapp2024-12-203-21/+22
|\ \ \ \ | |_|/ / |/| | | Fix 2 darr (dynamic-array) bugs
| * | | lib: darr: fix bug with nested macro useChristian Hopps2024-12-161-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - WHen declaring macro scoped variables, can run into problem if the macro variable passed in has the same name as the new variable introduced in the inner scope. We don't get a warning and the uses will be wrong. e.g., ``` { int __len = 10; foo(__len); // => 10 and not 15 as we wanted. } ``` Signed-off-by: Christian Hopps <chopps@labn.net>
| * | | lib: mgmtd: use less common macro scoped variable namesChristian Hopps2024-12-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ran into problem with darr macros and nested macros using the same name variables as passed in variables in an out scope. Make these macro scoped variables more unique as well. Signed-off-by: Christian Hopps <chopps@labn.net>
| * | | lib: darr: use the FRR printf formatterChristian Hopps2024-12-161-1/+2
| |/ / | | | | | | | | | Signed-off-by: Christian Hopps <chopps@labn.net>