Commit Graph

34623 Commits

Author SHA1 Message Date
Louis Scalbert
a1d4769eca bgpd: fix memory leak in rpki_create_socket
Fix memory leak in rpki_create_socket. Coverity scanner issue 1575914.

Fixes: a951752 ("bgpd: create cache server socket in vrf")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-23 13:13:13 +01:00
Louis Scalbert
b28fd4e527 bgpd: fix res validity in rpki_create_socket
Fix coverity scanner issue 1575912 where res pointer is supposed to
valid in:

> socket = vrf_socket(res->ai_family, ...)

but is checked for validity a few lines later.

Note that vrf_getaddrinfo returns an error code if getaddrinfo() fails
to allocate res and in this case, rpki_create_socket() returns.

Fixes: a951752 ("bgpd: create cache server socket in vrf")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-23 13:12:59 +01:00
Louis Scalbert
39c8c97d41 bgpd: fix deference before check in rpki_create_socket
Fix deference before check coverity scanner issue 1575918 in
rpki_create_socket()

Fixes: a951752d4a ("bgpd: create cache server socket in vrf")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-23 12:04:52 +01:00
Louis Scalbert
8c8bb3568a bgpd: fix potential null pointers in rpki
Fix potential NULL pointer in RPKI code. Coverity scanner issues: 1575911
1575913, 1575915, 1575917, 1575919 to 1575923, 1575925 and 1575926.

Fixes: 1420189c11 ("bgpd: add support of rpki in vrf configure context")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-23 12:04:49 +01:00
Igor Ryzhov
ed57daf60a mgmtd: remove unguarded debug log
The log doesn't provide any valuable information, so removing it instead
of adding a check.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 12:36:22 +02:00
Igor Ryzhov
a594cda8ce lib: remove leaf-list xpath hack from northbound
Currently, when editing a leaf-list, `nb_candidate_edit` expects to
receive it's xpath without a predicate and the value in a separate
argument, and then creates the full xpath. This hack is complicated,
because it depends on the operation and on the caller being a backend or
not. Instead, let's require to always include the predicate in a
leaf-list xpath. Update all the usages in the code accordingly.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 12:33:39 +02:00
Igor Ryzhov
8ffc3640f0 pimd: fix crash when configuring ssmpingd
Command: `ip ssmpingd 1.1.1.1`

Backtrace:
```
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
0x00007fd1d3b02859 in __GI_abort () at abort.c:79
0x00007fd1d3e323e1 in yang_dnode_xpath_get_canon (dnode=<optimized out>, xpath_fmt=<optimized out>, ap=<optimized out>) at lib/yang_wrappers.c:61
0x00007fd1d3e34f41 in yang_dnode_get_ipv4 (addr=addr@entry=0x7ffc368554d4, dnode=<optimized out>, xpath_fmt=xpath_fmt@entry=0x5556af8680d4 "./source-addr") at lib/yang_wrappers.c:826
0x00005556af8216d3 in routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_create (args=0x7ffc36855530) at pimd/pim_nb_config.c:925
0x00007fd1d3dec13f in nb_callback_create (nb_node=0x5556b197ea40, nb_node=0x5556b197ea40, errmsg_len=8192, errmsg=0x7ffc36855a90 "", resource=0x5556b18fa6f8, dnode=0x5556b1ad7a10, event=NB_EV_APPLY, context=0x5556b1ad75c0) at lib/northbound.c:1260
nb_callback_configuration (context=0x5556b1ad75c0, event=NB_EV_APPLY, change=<optimized out>, errmsg=0x7ffc36855a90 "", errmsg_len=8192) at lib/northbound.c:1648
0x00007fd1d3deca6c in nb_transaction_process (event=event@entry=NB_EV_APPLY, transaction=transaction@entry=0x5556b1ad75c0, errmsg=errmsg@entry=0x7ffc36855a90 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1779
0x00007fd1d3decdd6 in nb_candidate_commit_apply (transaction=0x5556b1ad75c0, save_transaction=save_transaction@entry=true, transaction_id=transaction_id@entry=0x0, errmsg=errmsg@entry=0x7ffc36855a90 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1129
0x00007fd1d3decf15 in nb_candidate_commit (context=..., candidate=<optimized out>, save_transaction=save_transaction@entry=true, comment=comment@entry=0x0, transaction_id=transaction_id@entry=0x0, errmsg=0x7ffc36855a90 "", errmsg_len=8192) at lib/northbound.c:1162
0x00007fd1d3ded4af in nb_cli_classic_commit (vty=vty@entry=0x5556b1ada2a0) at lib/northbound_cli.c:50
0x00007fd1d3df025f in nb_cli_apply_changes_internal (vty=vty@entry=0x5556b1ada2a0, xpath_base=xpath_base@entry=0x7ffc36859b50 ".", clear_pending=clear_pending@entry=false) at lib/northbound_cli.c:177
0x00007fd1d3df06ad in nb_cli_apply_changes (vty=vty@entry=0x5556b1ada2a0, xpath_base_fmt=xpath_base_fmt@entry=0x0) at lib/northbound_cli.c:233
0x00005556af80fdd5 in pim_process_ssmpingd_cmd (vty=0x5556b1ada2a0, operation=NB_OP_CREATE, src_str=0x5556b1ad9630 "1.1.1.1") at pimd/pim_cmd_common.c:3423
0x00007fd1d3da7b0e in cmd_execute_command_real (vline=vline@entry=0x5556b1ac9520, vty=vty@entry=0x5556b1ada2a0, cmd=cmd@entry=0x0, up_level=up_level@entry=0) at lib/command.c:982
0x00007fd1d3da7cb1 in cmd_execute_command (vline=vline@entry=0x5556b1ac9520, vty=vty@entry=0x5556b1ada2a0, cmd=0x0, vtysh=vtysh@entry=0) at lib/command.c:1040
0x00007fd1d3da7e50 in cmd_execute (vty=vty@entry=0x5556b1ada2a0, cmd=cmd@entry=0x5556b1ae0a30 "ip ssmpingd 1.1.1.1", matched=matched@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1207
0x00007fd1d3e278be in vty_command (vty=vty@entry=0x5556b1ada2a0, buf=<optimized out>) at lib/vty.c:591
0x00007fd1d3e27afd in vty_execute (vty=0x5556b1ada2a0) at lib/vty.c:1354
0x00007fd1d3e2bb23 in vtysh_read (thread=<optimized out>) at lib/vty.c:2362
0x00007fd1d3e22254 in event_call (thread=thread@entry=0x7ffc3685cd80) at lib/event.c:2003
0x00007fd1d3dce9e8 in frr_run (master=0x5556b183c830) at lib/libfrr.c:1218
0x00005556af803653 in main (argc=6, argv=<optimized out>, envp=<optimized out>) at pimd/pim_main.c:162
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 11:58:50 +02:00
Donatas Abraitis
92a56d2fa2
Merge pull request #15179 from donaldsharp/zebra_neigh_update
Zebra neigh update
2024-01-23 08:51:26 +02:00
Donatas Abraitis
b27f4e2435
Merge pull request #15193 from idryzhov/fix-bgp-rmap-probability
bgpd: fix route-map match probability deconfiguration callback
2024-01-23 08:49:30 +02:00
Christian Hopps
296cda5bc1
Merge pull request #15194 from idryzhov/dist-list-fixes
distribute-list fixes and improvements
2024-01-22 20:44:01 -05:00
Igor Ryzhov
664d14eadb vtysh: fix VTYSH_VRF definition
VTYSH_VRF is a collection of daemon flags, not node flags. The current
code works only because RPKI_VRF_NODE is 1100101 in binary, which
accidentally includes VTYSH_BGPD which is actually needed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 00:17:26 +02:00
Igor Ryzhov
83a698d891 ripngd: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate. Also, fix missing "IPv6"
docstring and use correct address family.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:59:30 +02:00
Igor Ryzhov
45b868a2af ripd: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:59:30 +02:00
Igor Ryzhov
aabe9cf377 eigrpd: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate. Also, use address-family-specific
autocompletion.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:59:30 +02:00
Igor Ryzhov
5ab02e99b7 babeld: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:49:39 +02:00
Igor Ryzhov
6dbd2465e1 lib: add address-family-specific autocompletion for prefix-lists
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:20:31 +02:00
Igor Ryzhov
061c69f3f5 lib: remove global list of distribute-lists
It's not needed anymore, all daemons always pass context.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:00:43 +02:00
Igor Ryzhov
47aa9fe18c babeld: pass distribute ctx to distribute-list functions
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:00:18 +02:00
Igor Ryzhov
5a759f8a69 eigrpd: convert distribute-list configuration to northbound
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 22:52:50 +02:00
Igor Ryzhov
7006880bc2 bgpd: fix route-map match probability deconfiguration callback
Add missing break. Currently, lib_route_map_entry_match_destroy is
called on every commit stage, but it should run only on APPLY.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 22:31:21 +02:00
Donald Sharp
01cb1fb82c sharpd: Allow sharpd to listen to neighbor events
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:19:20 -05:00
Donald Sharp
a0d38a7ac6 lib, nhrpd: Move neighbor reg/unreg to lib/zclient.c
This is needed to be generic.  Let's make it so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:14:59 -05:00
Donald Sharp
275edb5c16 *: Rename ZEBRA_NHRP_NEIGH_XXX to ZEBRA_NEIGH_XXX
This does not need to be nhrp specific.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:14:59 -05:00
Igor Ryzhov
22d1ad786f
Merge pull request #15185 from LabNConsulting/chopps/distlist
add northbound support to distribute-list code.
2024-01-22 16:52:45 +02:00
Donatas Abraitis
20ec72d7ca
Merge pull request #15052 from louis-6wind/rpki-vrf-92
bgpd: add VRF support to RPKI
2024-01-22 16:16:34 +02:00
Christian Hopps
cc9f4029cb ripngd: use new distribute-list northbound code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:33:40 +00:00
Christian Hopps
8f7a9355f2 ripd: use new distribute-list northbound code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:33:33 +00:00
Christian Hopps
a993b8e9bb lib: enable multiple instance support with distribute lists
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00:00
Christian Hopps
eba64f79cc lib: add northbound support to distribute-list code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00:00
Igor Ryzhov
8664dd9362
Merge pull request #15176 from LabNConsulting/chopps/mgmtd-northbound-fixes
Chopps/mgmtd northbound fixes
2024-01-22 12:48:15 +02:00
Donatas Abraitis
4494680404 doc: Add missing json keyword for show debugging label-table
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-21 23:16:38 +02:00
Vincent Jardin
bab32ec8dc tests: ospf point-to-multipoint and suppress
Per the RFC6860, check OSPFv2 using point-to-multipoint
over Ethernet.
Enable the behavior of the RFC6860 using:
  ip ospf prefix-suppress A.B.C.D
See:
  https://www.rfc-editor.org/rfc/rfc6860#section-2.3.2.2

Note that nexthops are not required to assess the checks.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
2024-01-21 21:06:50 +01:00
Donatas Abraitis
7041353fa9
Merge pull request #15125 from pguibert6WIND/srte_pcep_session_json
Dump PCEP session in json format
2024-01-21 21:33:35 +02:00
Donatas Abraitis
f6178ee2e1
Merge pull request #15184 from donaldsharp/zebra_touchups
Zebra touchups
2024-01-21 17:02:26 +02:00
Christian Hopps
dc8f136064 lib: cleanup yang lint warnings
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-21 13:12:26 +00:00
Donatas Abraitis
25c3de18a4
Merge pull request #15178 from donaldsharp/update_unnumbered_doc
doc: Update bgp unnumbered documentation
2024-01-21 13:45:45 +02:00
Donatas Abraitis
19672227ef
Merge pull request #15183 from donaldsharp/zebra_nhg_worms
zebra: Fix NEXTHOP_GROUP_FPM define value
2024-01-21 13:43:35 +02:00
Donald Sharp
63816f7579 zebra: use break instead of goto
There is a goto statement that would be better served
with a break statement.  Let's try to minimize this
in the code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-20 20:08:05 -05:00
Donald Sharp
af6499d052 zebra: Remove function that just calls another function
Why not just call the one function?

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-20 20:08:05 -05:00
Donald Sharp
daed95ddce zebra: Fix NEXTHOP_GROUP_FPM define value
The NEXTHOP_GROUP_FPM #define conflicts with
NEXTHOP_GROUP_KEEP_AROUND.  Not ideal let's fix
this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-20 19:10:07 -05:00
Donald Sharp
aa3a108672 doc: Update bgp unnumbered documentation
Mention the limitations of this type of peering
in bgp.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-19 13:37:36 -05:00
Christian Hopps
fa7ff16e2b mgmtd: remove heavy duplication in mgmtd config read
Previously each container created all it's decendents before descending into
the children and repeating the process.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:27:24 +00:00
Christian Hopps
9e34d817fc lib: better conditionalize leaf-list predicate xpath addition
If we're in the backend we already have the predicate added by mgmtd -- don't
add it again.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:27:24 +00:00
Christian Hopps
f05a4e3b57 lib: libyang logging temp off to avoid unwanted log message
We don't want libyang logging when an schema path doesn't exist
since this is an acceptable outcome.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:25:57 +00:00
Christian Hopps
e37f18b780
Merge pull request #15175 from idryzhov/affinity-map-fixes 2024-01-19 08:40:09 -05:00
Donatas Abraitis
2844d093b5
Merge pull request #15168 from mjstapp/daemon_logs
lib,vtysh: add per-daemon log file config
2024-01-19 10:56:15 +02:00
Igor Ryzhov
01be34fa34 zebra: fix default value for affinity-mode
- initialize the necessary bit when creating if_link_params
- fix CLI description to mark extended as the default mode
- correctly set mode to extended when using the "no" form of the command
- handle the "show_defaults" parameter correctly in cli_show callback

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:25 +02:00
Igor Ryzhov
733462a991 zebra: remove unnecessary checks from CLI
First, any data tree validation in CLI handler is not correct, because
this code won't be called when the change is done through any other
frontend. Second, these checks are not necessary at all, because NB
layer handles the change between admin-grp/affinity automatically.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:19 +02:00
Igor Ryzhov
f62e38cc36 zebra: fix link-params admin-grp config output
- it was not printed at all because of the incorrect `yang_dnode_exist`
  check
- the intended output was "admin-group" instead of "admin-grp" used in
  the actual CLI command

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:13 +02:00
Igor Ryzhov
a3bbe28e6d zebra: rework affinity-map update hook
Don't use config tree when updating internal daemon state. Everything
needed is already stored in internal structures.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:11 +02:00