Commit Graph

6021 Commits

Author SHA1 Message Date
Donald Sharp
286e6f8871 lib: Ensure SA that root cannot be NULL
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:53:47 -04:00
Donald Sharp
b8e24a0ad0 lib, zebra: Modify nexthop_cmp to allow you to use weight or not
Currently nexthop weight is a discriminator on whether or not
a nexthop matches.  There is a need to no use the weight as
part of this comparison function so let's add a boolean to
allow us to say use this or not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 13:22:06 -04:00
Donald Sharp
c5fd6ba2dc
Merge pull request #16602 from LabNConsulting/chopps/fix-warnings
mgmtd: fix a couple compilation warnings.
2024-08-18 15:22:33 -04:00
Carmine Scarpitta
075899dee0 lib: Fix compilation warning
Don't store unnecessary `len` returned by snprintf and snprintfrr function.

Fixes the following compilation warnings:

```
error	15-Aug-2024 13:54:10	In file included from lib/bfd.c:16:
error	15-Aug-2024 13:54:10	In file included from ./lib/zclient.h:22:
error	15-Aug-2024 13:54:10	In file included from ./lib/nexthop.h:14:
error	15-Aug-2024 13:54:10	./lib/srv6.h:338:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " USP");
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:343:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintfrr(str + len, size - len, " nh6 %pI6", &ctx->nh6);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:347:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintfrr(str + len, size - len, " nh4 %pI4", &ctx->nh4);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:354:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " vrf_id %u",
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:367:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " unknown(%s)", __func__);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-08-18 13:03:04 +02:00
Christian Hopps
e7fc74aa14 mgmtd: fix a couple compilation warnings.
Also an empty (thus non-replace) notify selectors message shouldn't
clear the selectors, it should just do nothing.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-08-18 05:33:29 -05:00
Donald Sharp
baa0a1df5b *: Fix spelling errors found
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-15 09:19:37 -04:00
Donald Sharp
b8b38a593c lib: Fix memory leak in snmp on shutdown
The events list is storing a `struct event *` allocated
as a MTYPE_TMP pointer, on shutdown ensure that it is
properly free'd up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-12 08:51:19 -04:00
Donatas Abraitis
423e8076b5
Merge pull request #16542 from donaldsharp/vtysh_stupidly_large
lib: Don't print warning if not a daemon
2024-08-11 11:43:46 +03:00
Donald Sharp
c79599e497
Merge pull request #16551 from idryzhov/distrib-del
lib: fix distribute-list deletion
2024-08-10 19:50:26 -04:00
Christian Hopps
64ac03c90b
Merge pull request #16511 from oplklum/master
Fix LYD_NEW_PATH_OUTPUT issue to support libyang v3.x
2024-08-10 03:46:11 -04:00
Lu.Mao
87c9060f90 lib: Fix LYD_NEW_PATH_OUTPUT issue to support libyang v3.x
Fix the LYD_NEW_PATH_OUTPUT undeclared error to support the latest libyang v3.x version,
and also compatible with old version.

Signed-off-by: Lu Mao <lu.mao@molex.com>
2024-08-09 17:32:37 -07:00
Igor Ryzhov
8fad4f317e lib: fix distribute-list deletion
When a whole distribute-list is deleted (can be done only using API),
all its children must be cleaned up manually.

Fixes #16538

Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
2024-08-10 01:36:15 +03:00
Donatas Abraitis
927be7a50e
Merge pull request #16539 from donaldsharp/tests_memory_shut
Tests memory shut
2024-08-09 13:30:30 +03:00
Donatas Abraitis
536d478049
Merge pull request #16535 from pguibert6WIND/srv6_nexthop_context
lib: add seg6localContext json attribute in nexthop information
2024-08-08 22:39:34 +03:00
Donald Sharp
cecf5716d5 lib: Don't print warning if not a daemon
vtysh will print out the `stupidly large FD limit` upon
every run of the program if the ulimit is set stupidly
large.  Prevent this from being displayed for vtysh.

Fixes: #16516
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-08 15:26:41 -04:00
Donald Sharp
208c53c90e isisd, lib: Cleanup linked list associated with snmp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-08 14:24:59 -04:00
Donald Sharp
db986aded4 lib: Cleanup memory associated with modules on shutdown
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-08 14:24:59 -04:00
Philippe Guibert
5d027fc791 lib: add seg6localContext json attribute in nexthop information
Some srv6 behaviors have a context attached that is visible if
no json is requested:

> # show ipv6 route
> [..]
> B>* 2001:db8:1:1:100::/128 [20/0] is directly connected, vrf10, seg6local End.DT6 table 10, weight 1, 00:00:14
> B>* 2001:db8:1:1:200::/128 [20/0] is directly connected, vrf20, seg6local End.DT6 table 20, weight 1, 00:00:14
>

The json does not dump this attribute:
> # show ipv6 route 2001:db8:1:1:100::/128 json
> [..]
>      "nexthops":[
>        {
>          "flags":3,
>          "fib":true,
>          "directlyConnected":true,
>          "interfaceIndex":6,
>          "interfaceName":"vrf10",
>          "active":true,
>          "weight":1,
>          "seg6local":{
>            "action":"End.DT6"
>          },
>        }
>

Add the json support for this.

>      "nexthops":[
>        {
>          "flags":3,
>          "fib":true,
>          "directlyConnected":true,
>          "interfaceIndex":6,
>          "interfaceName":"vrf10",
>          "active":true,
>          "weight":1,
>          "seg6local":{
>            "action":"End.DT6"
>          },
>          "seg6localContext":{
>            "table":10
>          }
>        }
>

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-08-08 11:36:01 +02:00
Igor Ryzhov
2b12d62e38 lib: fix crash on distribute-list delete
The destroy callback must be executed only once on APPLY stage.

Fixes #16528

Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
2024-08-08 01:17:11 +03: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
David Lamparter
e26c580588 vtysh: de-conditionalize and reorder install_node
There is entirely no point to these being conditional.  And pull them up
so the upcoming pre-parse code can work on a clean slate.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
ece3132471 lib/clippy: add CMD_ELEMENT_TKN
The command graph has its tail end nodes pointing at the
`struct cmd_element` rather than a `struct cmd_token`.  This is a bit
weird to begin with, but becomes very annoying for the python bindings
where there is just no `struct cmd_element`.

Create a `CMD_ELEMENT_TKN` type for `cmd_token` instead, and replace the
tail end token in the python bindings with an instance of that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
cb9d20b712 lib/clippy: improve graph node member access
Expose all of the struct members of cmd_token, and retrieve them
dynamically rather than copying them around.  The problem with copying
them is that they can change as a result of merge(), and if there is an
existing wrapper object around it will not have its copy updated to
match.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
e2344206ca lib/clippy: expose JOIN_TKN's fork node
FORK_TKN's join node is already exposed, mirror to expose JOIN_TKN's
fork node.

(contains minor cleanup to make checkpatch.pl shut up)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
3c1556f386 lib/clippy: expose graph nodes' back pointers
There's a wrapper for nodes' outgoing pointers, but not incoming yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
8511f39987 lib/clippy: allow accessing graph nodes by index
Add len(graph) and graph[i] wrappers to access arbitrary nodes in a
graph.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
f85e58af12 lib/clippy: add a __repr__ for graph nodes
Make it a little easier to work on python code using this wrapper.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
34a4f858b7 lib/clippy: wrap cmd_graph_merge via Graph.merge()
Export cmd_graph_merge() to python code via graph1.merge(graph2).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
7fb8729a32 lib/clippy: allow creating empty graph
When merging graphs, it makes sense to allow starting with an empty one.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
cf37c79f31 lib/clippy: dynamically wrap graph nodes
The number of nodes in a graph will change as soon as cmd_graph_merge is
supported as an operation, therefore size this dynamically.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
0bf664527d lib: allow static/pre-initialized vectors
Use alloced=0 to indicate that the array used in a vector is not in fact
dynamically allocated memory (yet).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
05e915984c lib: remove unused vector_copy()
Not used anywhere in FRR, kill it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
Rafael Zalamena
a2209b597a lib: define constant for plataforms missing it
Add definition of `TCP_MD5SIG_MAXKEYLEN` in the `sockopt.h` header so
users of it have the definition of the maximum key length for socket
authentication operations.

The following OSes reported failure in CI while building:
 - NetBSD 8
 - FreeBSD 11
 - FreeBSD 12

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-29 11:41:39 -03:00
Russ White
7f10381374
Merge pull request #15797 from pguibert6WIND/isis_srv6_ls_subnet
isis, lib: add isis srv6 end sid to ls_prefix
2024-07-26 14:45:01 -04:00
Louis Scalbert
9c0e668050 isisd: move flex_algo_delete into flex_algo_destroy
Move flex_algo_delete() content into isis_instance_flex_algo_destroy()
because it is called only once.

Rename _flex_algo_delete to flex_algo_free()

Cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-07-26 11:27:51 +02:00
Louis Scalbert
67e2718e1c lib: remove duplicated flex_algos_free prototype
Remove duplicated flex_algos_free prototype

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-07-26 11:24:37 +02:00
Christian Hopps
be9a6fc0ea lib: mgmtd: fix too early daemon detach of mgmtd
Correct FRR startup counts on a daemon's vty socket to be open when the
parent process exits. The parent process waits for `frr_check_detach()`
to be called by the child before exiting. The problem is when the
`FRR_MANUAL_VTY_START` flag is set the vty socket was not opened but
`frr_check_detach()` was called anyway.

Instead add a bool option for `frr_check_detach()` to be called when the
socket is opened with `frr_vty_serv_start()`, and do so when "manually"
calling said function (i.e., when FRR_MANUAL_VTY_START is set).

The `FRR_MANUAL_VTY_START` flag is only set by mgmtd. The reason we
wait to open the vty socket is so that mgmtd can parse the various
daemon specific config files it has taken over, after the event loop has
started, but before we receive any possible new config from `vtysh`.

fixes #16362

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-07-23 17:50:33 -04:00
Christian Hopps
7afd7d99f2 lib: move non-error from __log_err to __dbg
Additionally, print `errmsg_if_any` in successful debug messages
if non-NULL.

fixes #16386 #16043

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-07-22 07:54:50 -04:00
Jafar Al-Gharaibeh
7aeb51e194
Merge pull request #16406 from opensourcerouting/fix/remove_deprecation_for_show_threads
Drop deprecation for `show thread ...`
2024-07-19 13:19:17 -04:00
Donatas Abraitis
193e14e401 lib: Rename clear thread cpu ... to clear event cpu ...
Add a deprecation cycle also.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-17 02:17:59 +03:00
Donatas Abraitis
f46ce043fc lib, vtysh: Removed deprecated aliases for show thread ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-17 02:12:48 +03:00
Nathan Bahr
fd8edc3dfb pimd, lib, vtysh: Added new 'router pim[6] [vrf NAME]' config node
Moved all existing global/vrf PIM config to the new subnode.
Existing configuration updated to be hidden and deprecated.
Both versions of configuration still work together.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-07-16 13:30:35 -05:00
Philippe Guibert
4e76df0547 isis, lib: add isis srv6 end sid to ls_prefix
According to draft-ietf-lsr-isis-srv6-extensions draft,
the End SID should be available in link state prefix
information.

Add the SID information in the link state prefix, by
getting the END SID from the locator TLV information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-07-11 09:14:34 +02:00
David Lamparter
6ade526f7b lib: add some quick explainers for path vars
It's not immediately obvious what exactly the `frr_*dir` variables
exported from lib/libfrr.c are for.  Add a little text each to clarify.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-11 05:44:24 +02:00
David Lamparter
ebf05b4ee1
Merge pull request #16140 from donaldsharp/linklist_discouragement 2024-07-10 09:08:21 +02:00
Russ White
22db85a714
Merge pull request #16258 from opensourcerouting/tsan-20240620
lib, tests: fix some b0rked tests, then fix TSAN warnings
2024-07-09 11:36:24 -04:00
Acee Lindem
ed48014884 ospfd: Fix several problems with direct acknowledgments and improved delay acks.
1. On P2MP interfaces, direct ack would include the same LSA multiple times
      multiple packets are processed before the OSPF interfae direct LSA
      acknowledgment event is processed. Now duplicates LSA in the same event
      are suppressed.
   2. On non-broadcast interfaces, direct acks for multiple neighbors would be
      unicast to the same neighbor due to the multiple OSPF LS Update packets
      being process prior to the OSPF interface direct ack event. Now, separate
      direct acks are unicast to the neighbors requiring them.
   3. The interface delayed acknowledgment timer runs would run continously
      (every second as long as the interace is up). Now, the timer is set
      when delayed acknowledgments are queued and all queued delayed
      acknowledges are sent when it fires.
   4. For non-broadcast interface delayed acknowledgments, the logic to send
      to multiple neighbors wasn't working because the list was emptied while
      building the packet for the first neighbor.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-07-06 13:42:40 +00:00
vivek
b5682ffbf0 *: Add and use option for graceful (re)start
Add a new start option "-K" to libfrr to denote a graceful start,
and use it in zebra and bgpd.

zebra will use this option to denote a planned FRR graceful restart
(supporting only bgpd currently) to wait for a route sync completion
from bgpd before cleaning up old stale routes from the FIB. An optional
timer provides an upper-bounds for this cleanup.

bgpd will use this option to denote either a planned FRR graceful
restart or a bgpd-only graceful restart, and this will drive the BGP
GR restarting router procedures.

Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
2024-07-01 13:02:52 -07:00
Acee Lindem
c494702929 ospfd: Improve OSPF neighbor retransmission list granularity and precision
The current OSPF neighbor retransmission operates on a single per-neighbor
periodic timer that sends all LSAs on the list when it expires.
Additionally, since it skips the first retransmission of received LSAs so
that at least the retransmission interval (resulting in a delay of between
the retransmission interval and twice the interval. In environments where
the links are lossy on P2MP networks with "delay-reflood" configured (which
relies on neighbor retransmission in partial meshs), the implementation
is sub-optimal (to say the least).

This commit reimplements OSPF neighbor retransmission as follows:

   1. A new data structure making use the application managed
      typesafe.h doubly linked list implements an OSPF LSA
      list where each node includes a timestamp.
   2. The existing neighbor LS retransmission LSDB data structure
      is augmented with a pointer to the list node on the LSA
      list to faciliate O(1) removal when the LSA is acknowledged.
   3. The neighbor LS retransmission timer is set to the expiration
      timer of the LSA at the top of the list.
   4. When the timer expires, LSAs are retransmitted that within
      the window of the current time and a small delta (50 milli-secs
      default). The LSAs that are retransmited are given an updated
      retransmission time and moved to the end of the LSA list.
   5. Configuration is added to set the "retransmission-window" to a
      value other than 50 milliseconds.
   6. Neighbor and interface LSA retransmission counters are added
      to provide insight into the lossiness of the links. However,
      these will increment quickly on non-fully meshed P2MP networks
      with "delay-reflood" configured.
   7. Added a topotest to exercise the implementation on a non-fully
      meshed P2MP network with "delay-reflood" configured. The
      alternative was to use existing mechanisms to instroduce loss
      but these seem less determistic in a topotest.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-06-20 15:31:07 +00:00
David Lamparter
b9541fe77f lib: use seqlock slow path with TSAN
TSAN doesn't understand the OS specific "fast" seqlock code.  Use the
pthread mutex/condvar based path when TSAN is enabled.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-06-20 11:16:10 +02:00
David Lamparter
1f67dfb143 lib: fix typo in rcu_do()
I lost an underscore somewhere along the way.  Which never caused issues
because we don't use that function macro.  It is, however, useful for
testing, so fix it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-06-20 11:04:09 +02:00
Donald Sharp
69b36cdf07 lib: Discourage usage of deprecated data structures
Put some verbiage in place to warn people that we
are actively discouraging new development that uses
an older data structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-06-19 07:49:53 -04:00
Donald Sharp
c7276d1580
Merge pull request #16237 from pguibert6WIND/json_ttable_caml_format
lib: add json API to dump and override row naming convention
2024-06-18 15:26:00 -04:00
Russ White
7834c38ab3
Merge pull request #15604 from cscarpitta/srv6-sid-manager
Add support for SRv6 SID Manager
2024-06-18 12:16:24 -04:00
Russ White
ae4e030813
Merge pull request #16236 from opensourcerouting/fix/recursive_weighted_ecmp
zebra: Set the weight for non-recursive next-hop
2024-06-18 11:14:00 -04:00
Russ White
e9e8a4baa4
Merge pull request #16194 from opensourcerouting/fix/bfd_profile_shutdown
bgpd: Do not start BGP session if BFD profile is in shutdown state
2024-06-18 09:57:00 -04:00
Philippe Guibert
073fec520c lib: add json API to dump and override row naming convention
The following table is not compliant with caml format when displayed in
json:

>                 ttable_add_row(
>                         tt,
>                         "Vertex|Type|Metric|Next-Hop|Interface|Parent");
>
>                 ttable_json(tt, "ssdsss");

output observed:

> [..]
>        {
>          "Vertex":"r1",
>          "Type":"",
>          "Metric":0,
>          "Next-Hop":"",
>          "Interface":"",
>          "Parent":""
>        }

output expected:

> [..]
>        {
>          "vertex":"r1",
>          "type":"",
>          "metric":0,
>          "nextHop":"",
>          "interface":"",
>          "parent":""
>        }

Override the ttable_json() function with a new function which has an
extra paramter: this parameter will redefine the initial row value for
json:

> ttable_json_with_json_text(tt,
> "vertex|type|metric|nextHop|interface|parent");

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-18 14:33:41 +02:00
Donatas Abraitis
83b4706f30 lib: Get the weight from Zebra
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-18 12:15:33 +03:00
Philippe Guibert
36a310cc9f zebra, lib: add locator name in sid notify messages
In the near future, some daemons may only register SIDs. This may be
the case for the pathd daemon when creating SRv6 binding SIDs.

When a locator is getting deleted at ZEBRA level, the daemon may have
an easy way to find out the SIds to unregister to.

This commit proposes to add the locator name to the SID_SRV6_NOTIFY
message whenever possible. Only case when an allocation failure happens,
the locator will not be present. In all other places, the notify API
at procol levels has the locator name extra-parameter.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-17 17:09:45 +02:00
Carmine Scarpitta
4dcb69e0f9 zebra: Fix checkpatch warning
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
b90cb00974 lib: Add ZAPI command ZEBRA_SRV6_SID_NOTIFY
Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send
asynchronous SRv6 SIDs notifications to zclients.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
164117f2ec lib: Add missing info to locator encode/decode
Include block/node/function/argument lengthi when
encoding/decoding an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
ee1d20879b lib: Add ZAPI operations to get/release SRv6 SIDs
Add two new ZAPI operations: `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These APIs allow a daemon to get and
release an SRv6 SID, respectively.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
ded79d7013 lib: Add ZAPI operation get SRv6 locator
Add a new ZAPI operation, ZEBRA_SRV6_MANAGER_GET_LOCATOR, which allows a
daemon to request information about a specific locator from the SRv6 SID
Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
3cb88e6984 lib: Add support for SRv6 SIDs
Add a data structure to represent an SRv6 SID context and the related
management functions (allocate/free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
779d4c2702 zebra: CLI to specify format of an SRv6 locator
Add the CLI to choose the SID format of a locator. When the SID format
of a locator is changed, the SIDs allocated from that locator might no
longer be valid (for example, because the new format might involve a
different SID allocation schema). In such a case, it is necessary to
notify all the zclients so that they can withdraw/uninstall the old SIDs
that use the previous format and allocate/install/advertise the new SIDs
based on the new format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
f00554ed56 lib: Add function to copy an SRv6 locator
Add a new function to copy an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
35f4bedfa3 lib: Add CLI nodes to support SRv6 SID format
Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Carmine Scarpitta
021386a34e lib: Add support for SRv6 SID formats
Add functionalities to manage SRv6 SID formats (allocate / free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13 14:54:16 +02:00
Jafar Al-Gharaibeh
2e02bd2366
Merge pull request #16184 from LabNConsulting/chopps/fe-notify-select
mgmtd: add notification selection to front-end API
2024-06-13 00:20:09 -05:00
Donatas Abraitis
8dac2215ed
Merge pull request #16191 from pguibert6WIND/srte_color_not_copied
lib: fix copy srte_color from zapi_nexthop structure
2024-06-12 15:39:10 +03:00
Donatas Abraitis
1fb48f5d13 bgpd: Do not start BGP session if BFD profile is in shutdown state
If we do:

```
bfd
 profile foo
  shutdown
```

The session is dropped, but immediately established again because we don't
have a proper check on BFD.

If BFD is administratively shutdown, ignore starting the session.

Fixes: https://github.com/FRRouting/frr/issues/16186

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-12 08:39:48 +03:00
Christian Hopps
3dad09b228 mgmtd: add native session-req (create/delete) messages
This addition allows for a limited native-message-only front-end
interaction.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-11 10:37:31 -04:00
Philippe Guibert
49bc1b6c21 lib: fix copy srte_color from zapi_nexthop structure
When switching from nexthop to zapi_nexthop, the srte color
is copied. Do the same in reverse.

Fixes: 31f937fb43 ("lib, zebra: Add SR-TE policy infrastructure to zebra")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-10 12:13:56 +02:00
Donatas Abraitis
19c3e0eca6
Merge pull request #16093 from louis-6wind/fix-show-route-memory
zebra: fix Out Of Memory issue when displaying large route tables in JSON
2024-06-10 11:26:23 +03:00
Donald Sharp
2a00a648f1
Merge pull request #15900 from mikemallin/v6-vtep-lib-upstream
lib, bgpd, tests, zebra: prefix_sg changes for V6 VTEP
2024-06-07 14:34:11 -04:00
Philippe Guibert
cc25d7bd92 zebra, lib: upon lsp install, iterate nexthop accordingly
There are two ways of iterating over nexthops of a given
route entry.
- Either only the main nexthop are taken into account
(which is the case today when attempting to install an
LSP entry on a BGP connected labeled route.
- Or by taking into account nexthops that are resolved
and linked in nexthop->resolved of the previous nexthop
which has RECURSIVE flag set. This second case has to be
taken into account in the case where recursive routes may
be used to install an LSP entry.

Introduce a new API in nexthop that will parse over the
appropriate nexthop, if the nexthop-resolution flag is turned
on or not on the given VRF.

Use that API in the lsp_install() function so as to walk
over the appropriate nexthops.

Co-developed-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2024-06-07 12:33:47 +02:00
Louis Scalbert
03b1ee7a39 lib: add helpers to print json keys
Add helpers to print json keys in order to prepare the next commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-07 10:13:26 +02:00
Christian Hopps
657f1650e6 mgmtd: add front-end notification selector support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:53 -04:00
Christian Hopps
33b73f8e3a lib: native msg add array of strings support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:39:47 -04:00
Christian Hopps
22eccbfab9 lib: fix incorrect use of error checking macro
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:38:48 -04:00
Christian Hopps
e14781eb1d lib: darr: add free with element cleanup functions
- `darr_free_free` to `darr_free` each element prior to `darr_free`
  the array.
- `darr_free_func` to call `func` on each element prior to `darr_free`
  the array.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-06 22:38:48 -04:00
Christian Hopps
41c236120f lib: comments about public vs private message apis
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-04 00:51:33 -04:00
Mike RE Mallin
a514e34e30 bgpd, lib, zebra: Extend ES_VTEP_LIST_STR_SZ to support IPv6 addresses
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
f4f19cc20f lib, zebra: Update prefix_sg structure for IPv6 group support
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
b69ec60dc6 lib: Make the ip arg const in stream_put_ipaddr
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
b30523d3c9 lib: Add clang-format wrapper around printfrr_ext
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
f381bc2148 lib: Add ipaddr_is_same to compare IPv6 addresses
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:22 -04:00
Mike RE Mallin
75e8750142 lib: Add SET_IPADDR_NONE macro
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31 10:27:21 -04:00
David Lamparter
5daf64f63b lib: make python/ts_expand.py actually work
lib/typesafe.h was supposed to be outside the _TYPESAFE_EXPAND_MACROS
guard, so that including lib/atomlist.h grabs all the typesafe container
macros.

(No effect on normal build, as _TYPESAFE_EXPAND_MACROS is never defined
there.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-31 11:32:05 +02:00
Igor Ryzhov
f8abf96440
Merge pull request #15082 from louis-6wind/fix-iff-lower-up
lib: take into account the Linux IFF_LOWER_UP flag
2024-05-29 00:01:20 +03:00
Donatas Abraitis
b87d5a467e
Merge pull request #15980 from donaldsharp/agentx_update
*: Modify agentx to be allowed to be called
2024-05-20 22:33:01 +03:00
Philippe Guibert
4648225b53 zebra: fix dump SR-TE information if available
The SR-TE color of nexthop should be displayed in all situations.

Fixes: 553c804846 ("zebra: fix JSON fields for 'show ip/ipv6 nht'")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-15 15:45:33 +02:00
Philippe Guibert
05b6cfc71a zebra, lib: move nexthop display helper to lib folder
The zebra_nexthop_vty_helper() and zebra_nexthop_json_helper()
functions could be very helpful to display nexthop information
from whatever daemon.

Move the core function in the nexthop_vty_helper() and the
nexthop_json_helper() function. The zebra API call remains
unchanged.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-15 15:33:52 +02:00
Mark Stapp
a243fc2206
Merge pull request #15876 from opensourcerouting/typesafe-expand
python: add tool to expand typesafe definitions
2024-05-14 15:16:42 -04:00
Piotr Suchy
70e5005cba lib, vtysh, topotests: fix 'show ip[v6] access-list ... json' formatting
Similarly to recently fixed 'show ip[v6] prefix-list ...' - PR#15750,
json output is not valid for 'show ip[v6] access-list ... json' commands,
as it goes through all the running daemons and for each one it calls
'filter_show' creating a new json object. To aggreagate the output
and create a valid json that can later be parsed, the commands were
moved to vtysh and formatted accordingly

Signed-off-by: Piotr Suchy <piotrsuchy@proton.me>
2024-05-14 13:22:20 +02: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
Donatas Abraitis
e797b137f3 lib: Allow doing match/set tag untagged
In route-map: `match tag untagged`.

E.g. Cisco/Juniper allows that, but they use `match tag 0` instead.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-10 09:50:18 +03:00
Donald Sharp
c47f9ad7f4
Merge pull request #15962 from opensourcerouting/zmq-xref-setup
lib: stick `XREF_SETUP` into libfrrzmq
2024-05-08 09:56:12 -04:00
Martin Winter
8e2b2caf65
Merge pull request #15608 from vjardin/libyang3
libyang3 - fondation step 1
2024-05-08 12:48:03 +02:00