Commit Graph

35139 Commits

Author SHA1 Message Date
Donald Sharp
c514e84979
Merge pull request #15516 from opensourcerouting/freebsd-printf-sync-20240310
lib/printf: pick up ISO C23 / N2680 from FreeBSD
2024-03-11 10:32:32 -04:00
Donald Sharp
0042ea49b5
Merge pull request #15513 from opensourcerouting/fix/bgp_default_software_version
bgpd: Fix `no` form for `neighbor X capability software-version`
2024-03-11 07:17:09 -04:00
Donald Sharp
1c996aaa75
Merge pull request #15514 from opensourcerouting/fix/bgp_dynamic_capability_handle_unset
bgpd: Unset advertised capabilities if capability is disabled
2024-03-11 07:16:24 -04:00
Igor Ryzhov
fb912e0900 lib: fix initialization of northbound nodes
When actions and notification are defined as descendants of other nodes,
they are not getting initialized, because the iterator skips them. Fix
the iterator to include them when traversing the schema.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-10 20:51:55 +02:00
Donald Sharp
5c30b2e212
Merge pull request #15515 from opensourcerouting/zlog-recirculate-ldpd
ldpd, lib: integrate lde/ldpe into standard logging infrastructure
2024-03-10 13:12:46 -04:00
Donatas Abraitis
fd613d1b0c tests: Check if capabilities can be disabled via dynamic capabilities
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-10 18:53:39 +02:00
Donatas Abraitis
78757362f2 bgpd: Allow dynamically disable graceful-restart/long-lived graceful-restart
If we enter `bgp graceful-restart-disable`, make sure we disable the capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-10 18:25:30 +02:00
David Lamparter
02af04f73d doc: update re. ISO C23 printf changes
The new `%w99d` fixed-width modifier still needs work in `frr-format`,
which unfortunately is not as trivial as `%b` was.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-03-10 15:29:17 +01:00
David Lamparter
a7ab0c943d lib/printf: update README
Make a note that `%w[f](8|16|32|64)d` was picked up.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-03-10 15:29:17 +01:00
David Lamparter
91fdb7366c tests: exercise %w/%wf printfrr modifiers
Added by ISO C23 / N2680, implementation imported from FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-03-10 15:29:17 +01:00
Dag-Erling Smørgrav
c917023380 lib/printf: Implement N2680.
This adds specific width length modifiers in the form of wN and wfN
(where N is 8, 16, 32, or 64) which allow printing intN_t and
int_fastN_t without resorting to casts or PRI macros.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41725

FRR changes only include printf(), scanf/strtol are not locally
implemented in FRR.  Also added "(void) 0" to empty "else ..." to
avoid a compiler warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from FreeBSD commit bce0bef3c6abab92c7ac8cc23b7cc632a382721e)
2024-03-10 15:29:17 +01:00
David Lamparter
95a737ed1b ldpd: use zlog recirculation for subprocesses
This way, full functionality of `zlog_*` is available.

Having `fatal()` be wrappers around `assertf()` also means we get
backtraces, which is not the case for a plain `exit(1)`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-03-10 12:42:14 +01: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
Donatas Abraitis
77102e853e bgpd: Unset advertised capabilities if capability is disabled
When using dynamic capabilities, do not forget to unset advertised capabilities.

Otherwise, it's kept as advertised.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 22:23:37 +02:00
Donatas Abraitis
2038fad33e bgpd: Fix no form for neighbor X capability software-version
If `bgp default software-version-capability` is enabled, allow unsetting this
for a single neighbor also.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 21:52:17 +02:00
Donatas Abraitis
aa6ceeeb5b
Merge pull request #15510 from idryzhov/fix-rip-ripng-rpc
fix rip/ripng yang rpcs
2024-03-09 11:15:20 +01:00
Donatas Abraitis
a201559a4a lib: Drop include/linux/mroute[6].h
Not needed anymore since a5389154a1.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:34:41 +02:00
Donatas Abraitis
b0b0d7ab08 docker: Fix post function for Alpine build (package)
It was using a wrong sysdir.

```
--------------------
  72 |     # Own the config / PID files
  73 |     RUN mkdir -p /var/run/frr
  74 | >>> RUN chown -R frr:frr /etc/frr /var/run/frr
  75 |
  76 |     # Simple init manager for reaping processes and forwarding signals
--------------------
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:40 +02:00
Donatas Abraitis
3f7cc3b7f5 docker: Do not use pip Python package manager
Alpine Linux gets this with 3.19:

This is already installed with `pytest` via apk package manager.

```
15 78.20 error: externally-managed-environment
15 78.20
15 78.20 × This environment is externally managed
15 78.20 ╰─>
15 78.20     The system-wide python installation should be maintained using the system
15 78.20     package manager (apk) only.
15 78.20
15 78.20     If the package in question is not packaged already (and hence installable via
15 78.20     "apk add py3-somepackage"), please consider installing it inside a virtual
15 78.20     environment, e.g.:
15 78.20
15 78.20     python3 -m venv /path/to/venv
15 78.20     . /path/to/venv/bin/activate
15 78.20     pip install mypackage
15 78.20
15 78.20     To exit the virtual environment, run:
15 78.20
15 78.20     deactivate
15 78.20
15 78.20     The virtual environment is not deleted, and can be re-entered by re-sourcing
15 78.20     the activate file.
15 78.20
15 78.20     To automatically manage virtual environments, consider using pipx (from the
15 78.20     pipx package).
15 78.20
15 78.20 note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:40 +02:00
Donatas Abraitis
fd93b7d89a docker: Use Alpine Linux version 3.19
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:40 +02:00
Donatas Abraitis
e9ff59401c vtysh: Include fnctl.h for vtysh_main
Fixing compilation for Alpine Linux:

```
25 91.59 vtysh/vtysh_main.c: In function 'vtysh_flock_config':
25 91.59 vtysh/vtysh_main.c:276:20: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration]
25 91.59   276 |         flock_fd = open(flock_file, O_RDONLY, 0644);
25 91.59       |                    ^~~~
25 91.59       |                    popen
25 91.60 vtysh/vtysh_main.c:276:37: error: 'O_RDONLY' undeclared (first use in this function)
25 91.60   276 |         flock_fd = open(flock_file, O_RDONLY, 0644);
25 91.60       |                                     ^~~~~~~~
25 91.60 vtysh/vtysh_main.c:276:37: note: each undeclared identifier is reported only once for each function it appears in
25 91.60   CC       zebra/if_netlink.o
25 91.61 vtysh/vtysh_main.c: In function 'main':
25 91.61 vtysh/vtysh_main.c:637:49: error: 'O_CREAT' undeclared (first use in this function)
25 91.61   637 |                         fp = open(history_file, O_CREAT | O_EXCL,
25 91.61       |                                                 ^~~~~~~
25 91.62 vtysh/vtysh_main.c:637:59: error: 'O_EXCL' undeclared (first use in this function)
25 91.62   637 |                         fp = open(history_file, O_CREAT | O_EXCL,
25 91.62       |                                                           ^~~~~~
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:40 +02:00
Donatas Abraitis
f03b0bfaa4 lib: Fix unknown sig_atomic_t compile error
This is happening for Alpine Linux.

```
26 64.59 ./lib/sigevent.h:23:18: error: unknown type name 'sig_atomic_t'
26 64.59    23 |         volatile sig_atomic_t caught; /* private member   */
26 64.59       |                  ^~~~~~~~~~~~
26 64.60 In file included from ./lib/libfrr.h:12,
26 64.60                  from ./lib/vty.h:28,
26 64.60                  from ./lib/command.h:11,
26 64.60                  from ./lib/debug.h:11,
26 64.60                  from ./mgmtd/mgmt.h:12,
26 64.60                  from mgmtd/mgmt_history.c:14:
26 64.60 ./lib/sigevent.h:23:18: error: unknown type name 'sig_atomic_t'
26 64.60    23 |         volatile sig_atomic_t caught; /* private member   */
26 64.60       |                  ^~~~~~~~~~~~
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:00 +02:00
Donatas Abraitis
3ca01bf1e9 docker: Use libyang 2.1.128 for Alpine builds
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-09 09:33:00 +02:00
Donatas Abraitis
b4bd6c8557
Merge pull request #15509 from donaldsharp/freebsd_cleanups
pimd: Cleanup inclusion of headers
2024-03-09 08:31:48 +01:00
Igor Ryzhov
c544b9e8e7 ripngd: fix "clear ipv6 ripng" command
mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripngd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-09 00:01:01 +02:00
Igor Ryzhov
1ba97510e2 ripd: fix "clear ip rip" command
mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-09 00:00:12 +02:00
Donald Sharp
a5389154a1 pimd: Cleanup inclusion of headers
FRR needs to properly include the FreeBSD headers for
compilation on FreeBSD.  I have setup v6 as well
but I have not even tested it.  Since I know
that the form is the same I think this is ok
at the moment.  This is a step forward.

Because of this change *clearly* no-one is even
using pim on FreeBSD.  <look at the MRT_XXX values
to prove to yourself>.  In any event this is a step
in the direction of getting that working again.

Signed-off-by: Donald Sharp <sharpd@freebsd.network>
2024-03-08 18:04:34 +00:00
Donald Sharp
7e058c201a
Merge pull request #15469 from LabNConsulting/chopps/keychain-yang
add ietf-key-chain YANG module support
2024-03-08 08:15:02 -05:00
Donald Sharp
0d31f63dba
Merge pull request #15497 from idryzhov/show-run-fixes
a couple of fixes for "show running-config"
2024-03-08 08:11:14 -05:00
Donatas Abraitis
10486960b4
Merge pull request #15506 from fdumontet6WIND/local_link
ospf6d: add localLinkLocalAddress field
2024-03-08 08:19:25 +01:00
Rajasekar Raja
a8efa994da zebra: backpressure - Zebra push back on Buffer/Stream creation
Currently, the way zebra works is it creates pthread per client (BGP is
of interest in this case) and this thread loops itself in zserv_read()
to check for any incoming data. If there is one, then it reads,
validates and adds it in the ibuf_fifo signalling the main thread to
process the message. The main thread when it gets a change, processes
the message, and invokes the function pointer registered in the header
command. (Ex: zserv_handlers).

Finally, if all of this was successful, this task reschedules itself and
loops in zserv_read() again

However, if there are already items on ibuf FIFO, that means zebra is
slow in processing. And with the current mechanism if Zebra main is
busy, the ibuf FIFO keeps growing holding up the memory.

Show memory zebra:(Example: 15k streams hoarding ~160 MB of data)
--- qmem libfrr ---
Stream             :       44 variable   3432352    15042 161243800

Fix:
Client IO Thread: (zserv_read)
 - Stop doing the read events when we know there are X number of items
   on the FIFO already.(X - zebra zapi-packets <1-10000> (Default-1000)

 - Determine the number of items on the zserv->ibuf_fifo. Subtract this
   from the work items and only pull the number of items off that would
   take us to X items on the ibuf_fifo again.

 - If the number of items in the ibuf_fifo has reached to the maximum
      * Either initially when zserv_read() is called (or)
      * when processing the remainders of the incoming buffer
   the client IO thread is woken by the the zebra main.

Main thread: (zserv_process_message)
If the client ibuf always schedules a wakeup to the client IO to read
more items from the socked buffer. This way we ensure
 - Client IO thread always tries to read the socket buffer and add more
   items to the ibuf_fifo (until max limit)
 - hidden config change (zebra zapi-packets <>) is taken into account

Ticket: #3390099

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-03-07 15:16:33 -08:00
Francois Dumontet
c1e57dc4bd ospf6d: add localLinkLocalAddress field
add localIfaceAdress field in show ipv6 ospf6 neighbor detail json
command.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-03-07 14:33:47 +01:00
Donatas Abraitis
2e840a5339
Merge pull request #15498 from idryzhov/mgmt-change-error
mgmtd: change error message
2024-03-07 08:25:29 +01:00
Igor Ryzhov
bbaf34b117 mgmtd: change error message
Make the wording clearer about what's going on.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-06 23:57:30 +02:00
Igor Ryzhov
1db1fbf7a6 ripngd: fix missing "exit" for "router ripng"
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-06 21:43:44 +02:00
Igor Ryzhov
aaa6c7088e ripd: fix missing "exit" for "router rip"
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-06 21:42:53 +02:00
Igor Ryzhov
18da736949 lib: fix order of interfaces in the config
Add missing cli_cmp callback. Without it, interfaces are not sorted and
printed in order they were created.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-06 21:41:35 +02:00
Donatas Abraitis
dfe570e988
Merge pull request #15487 from idryzhov/nb-apply-finish
lib: fix apply_finish callback in northbound
2024-03-06 08:44:09 +02:00
Donatas Abraitis
864844a2e8
Merge pull request #15486 from donaldsharp/make_prefix
bgpd: pi->attr is deref'ed in all paths leading up to test
2024-03-06 08:43:40 +02:00
Donatas Abraitis
bb5a2a9375
Merge pull request #15489 from idryzhov/vty-mgmt-error
vty: change output of errors from mgmtd
2024-03-06 08:43:16 +02:00
Donatas Abraitis
7338aa601c
Merge pull request #15492 from donaldsharp/no_vrfs
tests: test invokes a script which does not exist
2024-03-06 08:42:37 +02:00
Donald Sharp
3a78d75cd5 tests: test invokes a script which does not exist
Apparently test_bgp_peer_type_multipath_relax.py does
no really need to run a `setup_vrfs` script.  Looking
at the other configuration for this test there are
no vrf's in the frr configuration.  So let's remove it

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-05 15:55:07 -05:00
Donatas Abraitis
ffab0d7fbc
Merge pull request #15222 from chiragshah6/fdev2
bgpd:aggr summary-only remove suppressed from evpn
2024-03-05 22:36:30 +02:00
Russ White
ac34badf71
Merge pull request #15397 from idryzhov/zebra-oper
zebra: oper data additions
2024-03-05 11:41:35 -05:00
Igor Ryzhov
1853ccdb0f vty: change output of errors from mgmtd
Make errors look the same way as in regular non-mgmtd vty. We don't need
to show information about some internal request names.

Before:
```
ERROR: SET_CONFIG request failed, Error: YANG error(s):
 Path: Data location "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']".
 Error: Unique data leaf(s) "value" not satisfied in "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']" and "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']".
```

After:
```
% Configuration failed.

YANG error(s):
 Path: Data location "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']".
 Error: Unique data leaf(s) "value" not satisfied in "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']" and "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']".
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-05 17:56:21 +02:00
Donald Sharp
a9c16a0a89 bgpd: pi->attr is deref'ed in all paths leading up to test
In make_prefix, the code checks to see if the pi->attr
is non-NULL.  Since (A) we cannot have a path_info without
an attribute and (B) all paths leading up to the test
in make_prefix already have pi->attr deref'ed and the
code is not crashing we know this is safe to remove.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-05 10:37:48 -05:00
Chirag Shah
f345460b7e tests:add topotest for EVPN aggregate prefix route
Toptotest covers to aggregate EVPN prefix routes.

Testing:

tests/topotests/bgp_evpn_vxlan_svd_topo1$ sudo -E python3 -m pytest -s -vv --cli-on-error
PASSED
test_bgp_evpn_vxlan_svd.py::test_pe_advertise_aggr_evpn_route
--------------------- live log call -------------------------------
2024-03-04 19:59:45,340 INFO: P1: checking if daemons are running
2024-03-04 19:59:45,444 INFO: PE1: checking if daemons are running
2024-03-04 19:59:45,578 INFO: PE2: checking if daemons are running
2024-03-04 19:59:45,680 INFO: host1: checking if daemons are running
2024-03-04 19:59:45,798 INFO: host2: checking if daemons are running
2024-03-04 19:59:45,896 INFO: topo: Checking BGP EVPN route contains non-aggregate prefixes
2024-03-04 19:59:45,992 INFO: topo: Configure BGP aggregate-address summary-only under ipv4-unicast
2024-03-04 19:59:46,120 INFO: topo: Checking BGP EVPN route contains aggregated prefix
PASSED

------- generated xml file: /tmp/topotests/topotests.xml -----
======= 10 passed, 1 skipped in 47.95s =====

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-03-05 07:03:39 -08:00
Chirag Shah
5cb7712b3e bgpd:aggr summary-only remove suppressed from evpn
Ticket: #3534718 #3720960
Testing Done:

Config:
router bgp 65564 vrf sym_2
 bgp router-id 27.0.0.9
 !
 address-family ipv4 unicast
  redistribute static
 exit-address-family

vrf sym_2
 vni 8889
 ip route 63.2.1.0/24 blackhole
 ip route 63.2.1.2/32 blackhole
 ip route 63.2.1.3/32 blackhole
exit-vrf

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[24]:[63.2.1.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
--
*> [5]:[0]:[32]:[63.2.1.2] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
*> [5]:[0]:[32]:[63.2.1.3] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

tor-1(config)# router bgp 65564 vrf sym_2
tor-1(config-router)# address-family ipv4 unicast
tor-1(config-router-af)# aggregate-address 63.2.0.0/16 summary-only
tor-1(config-rou-f)# end

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2.1
tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[16]:[63.2.0.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-03-05 07:03:39 -08:00
Russ White
cf4d838e69
Merge pull request #15479 from opensourcerouting/fix/spelling
doc: Fix one spelling `dissallowed` to `disallowed`
2024-03-05 08:48:56 -05:00
Russ White
0bc1c70f65
Merge pull request #15460 from Max-Mustermann33/route-metric-update
ospfd: Send update for route with new metric
2024-03-05 08:45:45 -05:00