Commit graph

182 commits

Author SHA1 Message Date
Christian Hopps 5f2a927d7b lib: northbound/mgmtd: add backend model support
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-14 18:48:59 +00:00
Christian Hopps 8a52b69ca4 lib: northbound: add basic oper-state update functions
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-13 23:40:52 -05:00
David Lamparter 4bc41193e8 vtysh, lib: preprocess CLI graphs
Store a parsed and built graph of the CLI nodes in vtysh, rather than
parsing and building that graph every time vtysh starts up.

This provides a 3x to 5x reduction in vtysh startup overhead:

`vtysh -c 'configure' -c 'interface lo' -c 'do show version'`

- before: 92.9M cycles, 1114 samples
- after: 16.5M cycles, 330 samples

This improvement is particularly visible for users scripting `vtysh -c`
calls, which notably includes topotests.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
Donald Sharp 73ad64a6f4 *: Modify agentx to be allowed to be called
If you had a situation where an operator turned on
ospfd with snmp but not ospf6d and agentx was configured
then you get into a situation where ospf6d would complain
that the config for agentx did not exist.  Let's modify
the code to allow this situation to happen.

Fixes: #15896
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-10 10:16:29 -04:00
David Lamparter b472b024ea yang: ietf-netconf-acm needs to be in libfrr
ietf-key-chain depends on ietf-netconf-acm, and lib/ code sets up the
former, so ietf-netconf-acm needs to be embedded in the libfrr too.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25 15:06:14 +02:00
Igor Ryzhov 84a00a47b8 *: remove confd plugin
ConfD is not supported anymore and its use is discouraged by developers:
https://discuss.tail-f.com/t/confd-premium-no-longer-available-future-of-confd/4552/6

Remove the code and all mentions of ConfD from the documentation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-15 00:58:10 +02:00
David Lamparter 5f16c640c2 lib: allow recirculating/relaying log messages
This is primarily intended for ldpd with its split-process architecture.
The LDE/LDPE subprocesses currently lose the extended zlog
functionality.

The zlog_live target already encapsulates all necessary bits for vtysh.
Reuse it for a relay function to be used in the main ldpd process.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-03-10 12:42:02 +01:00
Christian Hopps 4caffbda8e lib: add keychain northbound support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-03-04 20:00:15 -05:00
Mark Stapp 31015c3ad9 lib,vtysh: add per-daemon log file config
Add a config that specifies per-deamon log file names.
Move the handy generated list of daemon names from vtysh to lib;
edit the gitignore files to match.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-01-17 16:15:07 -05:00
Donald Sharp 10387101fe lib: Breakout sendmmsg into it's own header
The only 2 places sendmmsg is used is in zlog_5424.c
and zlog_live.c.  Why is the rest of the entire system
paying for this compilation?

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 13:56:09 -05:00
Christian Hopps ad1ccb6e62 lib: northbound: add yielding and batching to oper-state queries
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00
Christian Hopps 8790457c46 lib: add simplified native msg support
This is intended to replace protobuf use in mgmtd.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-26 08:34:56 -05:00
Igor Ryzhov c0568d4f9e lib, mgmtd: move common header to lib
The common header included from lib and other daemons should be located
in lib, not in mgmt directory.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-17 11:27:03 +01:00
Donald Sharp 6de9f7fbf5 *: Move distance related defines into their own header
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:47:51 -05:00
Christian Hopps e6e0c5bd25 lib: add dynamic array type
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-27 18:00:56 -04:00
Christian Hopps cfa0facbf9 mgmtd: fully implement debug flags for mgmtd and clients
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-01 13:47:12 -04:00
David Lamparter edaee5461d build: fix frr-if-rmap.yang model embedding
This was missed somewhere along the line, causing ripd to not start.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-04-24 17:02:34 +02:00
Hiroki Shirokura 735fb37db1 lib: add library for igp flexible-algorithm
Add a library to deal with Flexible Algorithm that will be common to
IS-IS and OSPF. The functions enables to deal with:

- Affinity-maps
- Extended Admin Group (RFC7308)
- Flex-Algo structures that contains the flex-algo configurations

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-18 10:13:58 +02:00
Hiroki Shirokura 81a067cd92 lib,isisd: refactor igp-agnostic sr misc functions
SR Algorithms are independent of specific IGPs
such as IS-IS. This commit adds lib/sr to
aggregate IGP agnostic functions and constants.

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-18 10:11:43 +02:00
Christian Hopps efa2ca6ef0 lib: convert if_rmap to YANG northbound
- nice correspondence between new YANG grouping and shared library code.
- fixes bug with RIPNG use, certainly didn't work before.
- removes rip header from shared library code
- still has uses RIP_NODE/RIPNG_NODE as required by CLI foo.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-11 15:27:05 -04:00
Russ White f26a87cd24
Merge pull request #12698 from Orange-OpenSource/isisd
Isisd/Lib: Add new printfrr format facility for Intermediate System ID
2023-04-11 09:49:01 -04:00
Donald Sharp 2c38c794a0 lib: Remove getopt.c and getopt1.c
Why do we need getopt code that is standard in everything
that we compile against?

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-28 10:07:38 -04:00
Donald Sharp 24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
Christian Hopps c9f0e90b60 lib: new message library for mgmtd client and adapters
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-03-22 05:22:56 +00:00
Christian Hopps 7d65b7b7f4 mgmtd: Add MGMT Backend Interface Framework
This commit introduces the MGMT Backend Interface which can be used
by back-end management client daemons like BGPd, Staticd, Zebra to
connect with new FRR Management daemon (MGMTd) and utilize the new
FRR Management Framework to let any Frontend clients to retrieve any
operational data or manipulate any configuration data owned by the
individual Backend daemon component.

This commit includes the following functionalities in the changeset:
1. Add new Backend server for Backend daemons connect to.
2. Add a C-based Backend client library which can be used by daemons
   to communicate with MGMTd via the Backend interface.
3. Maintain a backend adapter for each connection from an appropriate
   Backend client to facilitate client requests and track one or more
   transactions initiated from Frontend client sessions that involves
   the backend client component.
4. Add the following commands to inspect various Backend client
   related information
	a. show mgmt backend-adapter all
	b. show mgmt backend-yang-xpath-registry
        c. show mgmt yang-xpath-subscription

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Christian Hopps ef43a6329b mgmtd: Add MGMT Frontend Interface Framework
This commit introduces the Frontend Interface which can be used
by front-end management clients like Netconf server, Restconf
Server and CLI to interact with new FRR Management daemon (MGMTd)
to access and sometimes modify FRR management data.

This commit includes the following functionalities in the changeset:
1. Add new Frontend server for clients connect to.
2. Add a C-based Frontend client library which can be used by Frontend
   clients to communicate with MGMTd via the Frontend interface.
3. Maintain a frontend adapter for each connection from an appropriate
   Frontend client to facilitate client requests and track one or more
   client sessions across it.
4. Define the protobuf message format for messages to be exchanged
   between MGMTd Frontend module and the Frontend client.
5. This changeset also introduces an instance of MGMT Frontend client
   embedded within the lib/vty module that can be leveraged by any FRR
   daemon to connect to MGMTd's Frontend interface. The same has been
   integrated with and initialized within the MGMTd daemon's process
   context to implement a bunch of 'set-config', 'commit-apply',
   'get-config' and 'get-data' commands via VTYSH

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Olivier Dugeon 7f9ab3b0bb lib: Add ISO System & Network format to printfrr
Like for IP addresses, this patch add a new format for printfrr collection to
print ISO System ID and Network address a.k.a IS-IS system ID & Network.
This new format is added to the library instead of isisd because other daemons
and tools need to print ISO System ID & Network Address.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-03-21 15:19:09 +01:00
Russ White ba755d35e5
Merge pull request #12248 from pguibert6WIND/bgpasdot
lib, bgp: add initial support for asdot format
2023-02-21 08:01:03 -05:00
Olivier Dugeon e2b958ecbc
Merge pull request #12494 from louis-6wind/ext_admin_group
lib,zebra,isisd: add support for extended admin group RFC7308
2023-02-15 09:42:03 +01:00
Donald Sharp 1c950f37b7 lib: Add debug routemap [detail]
Add the ability to turn on `debug routemap detail` for FRR.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-13 09:40:47 -05:00
Louis Scalbert 158332617d lib,yang,zebra: add extended admin-group support
Add the support of Extended Admin-Group (RFC7308) to the zebra interface
link-params Traffic-Engineering context.

Extended admin-groups can be configured with the affinity-map:

> affinity-map blue bit-position 221
> int eth-rt1
>  link-params
>   affinity blue
>  exit-link-params

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-02-10 11:31:05 +01:00
Philippe Guibert 8079a4138d lib, bgp: add initial support for asdot format
AS number can be defined as an unsigned long number, or
two uint16 values separated by a period (.). The possible
valus are:
- usual 32 bit values : [1;2^32 -1]
- <1.65535>.<0.65535> for dot notation
- <0.65535>.<0.65535> for dot+ notation.

The 0.0 value is forbidden when configuring BGP instances
or peer configurations.

A new ASN type is added for parsing in the vty.
The following commands use that new identifier:
- router bgp ..
- bgp confederation ..
- neighbor <> remote-as <>
- neighbor <> local-as <>
- clear ip bgp <>
- route-map / set as-path <>

An asn library is available in lib/ and provides some
services:
- convert an as string into an as number.
- parse an as path list string and extract a number.
- convert an as number into a string.

Also, the bgp tests forge an as_zero_path, and to do that,
an API to relax the possibility to have a 0 as value is
specifically called from the tests.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-10 10:27:17 +01:00
Louis Scalbert 05a12619dd lib,yang,zebra: add affinity-map support
Add the affinity-map global command to zebra. The syntax is:

> affinity-map NAME bit-position (0-1023)

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-02-09 15:48:21 +01:00
David Lamparter d173381edc build: consistently mkdir -p output for redirect
When running the build in a separate build directory, redirecting output
into a file can error out if the directory does not exist yet.  Some
places already had `mkdir -p` calls, but not all.

Make all occurences of this consistently use `@$(MKDIR_P)`.

(Extension of PR #12575 to catch more places.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-24 17:46:57 +01:00
Donatas Abraitis af5d731255 Revert "lib: BGP registration with IGP for BGP ORR rSPF calc"
This reverts commit a5dd4bf47d.
2023-01-17 18:15:56 +02:00
Siger Yang c317d3f246
zebra: traffic control state management
This allows Zebra to manage QDISC, TCLASS, TFILTER in kernel and do cleaning
jobs when it starts up.

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-22 22:35:35 +08:00
David Lamparter 89cb86aeb0 build, vtysh: extract vtysh commands from .xref
Rather than running selected source files through the preprocessor and a
bunch of perl regex'ing to get the list of all DEFUNs, use the data
collected in frr.xref.

This not only eliminates issues we've been having with preprocessor
failures due to nonexistent header files, but is also much faster.
Where extract.pl would take 5s, this now finishes in 0.2s.  And since
this is a non-parallelizable build step towards the end of the build
(dependent on a lot of other things being done already), the speedup is
actually noticeable.

Also files containing CLI no longer need to be listed in `vtysh_scan`
since the .xref data covers everything.  `#ifndef VTYSH_EXTRACT_PL`
checks are equally obsolete.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26 17:12:34 +01:00
Madhuri Kuruganti a5dd4bf47d lib: BGP registration with IGP for BGP ORR rSPF calc
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:29:24 +05:30
David Lamparter 8c6f41ff1d build: unconditionally enable format checks
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-02 10:37:55 -04:00
Loganaden Velvindron 04b4b595d3 lib/md5,lib/sha256: Use explicit_bzero to clean up sensitive data.
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-31 18:00:18 +04:00
Donald Sharp 485ac9a79b *: Fix spelling of neccessary
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:11:29 -04:00
Mark Stapp f0368a3e43 build: remove generated lib files during distclean
Remove a couple of lex/yacc output files in lib/
during 'distclean'.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-03-23 09:03:14 -04:00
Russ White e3aa338256
Merge pull request #10566 from whichbug/master
isisd: use base64 to encode the binary data.
2022-02-28 09:44:47 -05:00
David Lamparter 0798d2760d lib: implement terminal monitor for vtysh
Adds a new logging target that sends log messages to vtysh.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-28 13:28:43 +01:00
whichbug ac3133450d isisd: fix #10505 using base64 encoding
Using base64 instead of the raw string to encode
the binary data.

Signed-off-by: whichbug <whichbug@github.com>
2022-02-22 15:27:30 -05:00
Donald Sharp b564209367
Merge pull request #8458 from opensourcerouting/xref-5424
lib: RFC5424 syslog support
2022-02-08 15:56:20 -05:00
Olivier Dugeon fd8e262ab7 lib: Add CSPF Path Computation algorithm
As helper function of Segment Routing Flex Algo or RSVP-TE
add Constrained Shortest Path First algorithm able to compute
path with constraints. Supported constraints are as follow:
 - Standard IGP metric
 - TE IGP metric
 - Delay metric
 - Bandwidth for given Class of Service for bandwidth reservation (RSVP-TE)

Usage of CSPF algorithms is detailed in the doc/developer/cspf.rst file

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2022-02-02 17:04:12 +01:00
David Lamparter 1c6261a99e lib: RFC5424 & journald extended syslog target
Not much to say here, user docs are coming up in a separate commit.
RFC5424 and (systemd's) journald allow passing structured key-value
data.  This stuffs the metadata we have available into there.

The "does the system syslogd support RFC5424" question is unfortunately
not easily answered, so we can only give an affirmative answer on NetBSD
5.0+ or FreeBSD 12+.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 00:39:00 +01:00
David Lamparter f642358837 build: fix duplicate yang.c file inclusions
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11 15:49:40 +01:00