Commit Graph

35139 Commits

Author SHA1 Message Date
Donatas Abraitis
5e420114e1
Merge pull request #15520 from donaldsharp/bgp_dest_dev_build
bgpd: When using dev build add pointer information to %pBD
2024-03-18 22:49:27 +02:00
Acee Lindem
def1455dc8 ospfd: Send LS Updates in response to LS Request as unicast.
With this fix, OSPF LS Updates sent in response to OSPF LS Requests during the DB Exchange process will be sent as unicasts. Unless the timing of multiple database exchanges coincides, there is little chance that the LSAs in the LS Update are required by OSPF routers other than the one which elicited the LS Update.

This is somewhat ambigous in RFC 2328 and two errata have been filed for clarification:

https://www.rfc-editor.org/errata/eid7850
https://www.rfc-editor.org/errata/eid7851

FRR OSPFv3 (ospf6d) already does it correctly - see ospf6_lsupdate_send_neighbor(struct event *thread). Also, if there is any doubt, one can refer to the C++ code at ospf.org (John Moy's seminal OSPF reference implementation).

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-03-18 14:35:43 +00:00
Donald Sharp
051f2249e9
Merge pull request #15566 from idryzhov/daemonize-nb-logs
lib: remove nb/yang memory cleanup when daemonizing
2024-03-18 07:59:04 -04:00
Mark Stapp
8cc52ef79c
Merge pull request #15424 from askorichenko/master
zebra: fix route deletion during zebra shutdown
2024-03-18 07:44:14 -04:00
Donatas Abraitis
0ecea59c13
Merge pull request #15553 from fdumontet6WIND/as_path_loop
bgpd: make as-path-loop-detection conform to the framework
2024-03-18 10:54:21 +02:00
Donatas Abraitis
1308812f92
Merge pull request #15559 from donaldsharp/sig_event_crash_on_crash_problems
lib: Prevent crash then another crash from happening
2024-03-18 08:53:23 +02:00
Igor Ryzhov
a564710c34 lib: remove nb/yang memory cleanup when daemonizing
We're not calling any other termination functions to free allocated
memory when daemonizing except these two. There's no reason for such an
exception, and because of these calls we have the following libyang
warnings every time FRR is started:
```
MGMTD: libyang: String "15" not freed from the dictionary, refcount 2
MGMTD: libyang: String "200" not freed from the dictionary, refcount 2
MGMTD: libyang: String "mrib-then-urib" not freed from the dictionary, refcount 2
MGMTD: libyang: String "1000" not freed from the dictionary, refcount 2
MGMTD: libyang: String "10" not freed from the dictionary, refcount 2
MGMTD: libyang: String "5" not freed from the dictionary, refcount 2
```

Remove these calls to get rid of the unnecessary warnings.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-17 22:44:28 +02:00
Christian Hopps
2329a95872 tests: required formatting change
This code wasn't touched by the actual change; however, the formatting fix is
required.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-03-17 04:57:42 -04:00
Christian Hopps
71368f9e06 tests: enable code coverage reporting with topotests
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-03-17 04:53:13 -04:00
Donald Sharp
22ac450b79 lib: Prevent crash then another crash from happening
When a memory operation (malloc/free/... ) causes a crash
and the call to core_handler causes another crash then
instead of actually writing a core dump the alarm is
hit and the daemon in trouble will not cause a core dump.
Modify the shutdown code to just try to dump the buffers
and leave instead of cleaning up after itself.

Back Trace:

(gdb) bt
0  0x00007f17082ec056 in __lll_lock_wait_private () from /lib/x86_64-linux-gnu/libc.so.6
1  0x00007f17082fc8bd in ?? () from /lib/x86_64-linux-gnu/libc.so.6
2  0x00007f17082fee8f in free () from /lib/x86_64-linux-gnu/libc.so.6
3  0x00007f170866c2ea in qfree (mt=<optimized out>, ptr=<optimized out>) at lib/memory.c:141
4  0x00007f17086c156a in zlog_tls_free (arg=0x55584f816fb0) at lib/zlog.c:390
5  zlog_tls_buffer_fini () at lib/zlog.c:346
6  0x00007f1708695e5f in core_handler (signo=11, siginfo=0x7ffd173229f0, context=<optimized out>) at lib/sigevent.c:264
7  <signal handler called>
8  0x00007f17082fd7bc in ?? () from /lib/x86_64-linux-gnu/libc.so.6
9  0x00007f17082ff6e2 in calloc () from /lib/x86_64-linux-gnu/libc.so.6
10 0x00007f1708451e78 in lh_table_new () from /lib/x86_64-linux-gnu/libjson-c.so.5
11 0x00007f170844c979 in json_object_new_object () from /lib/x86_64-linux-gnu/libjson-c.so.5
12 0x000055584e002fd9 in evpn_show_all_routes (vty=vty@entry=0x55584fb5ea00, bgp=bgp@entry=0x55584f82c600, type=<optimized out>, json=json@entry=0x55584f998130, detail=<optimized out>,
    self_orig=<optimized out>) at bgpd/bgp_evpn_vty.c:3192
13 0x000055584e009ed6 in show_bgp_l2vpn_evpn_route (self=<optimized out>, vty=0x55584fb5ea00, argc=6, argv=0x55584f998970) at bgpd/bgp_evpn_vty.c:5048
14 0x00007f170863af60 in cmd_execute_command_real (vline=vline@entry=0x55584fa87cb0, vty=vty@entry=0x55584fb5ea00, cmd=cmd@entry=0x0, up_level=up_level@entry=0, filter=FILTER_RELAXED)
    at lib/command.c:1030
15 0x00007f170863b2be in cmd_execute_command (vline=vline@entry=0x55584fa87cb0, vty=vty@entry=0x55584fb5ea00, cmd=cmd@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1089
16 0x00007f170863b550 in cmd_execute (vty=vty@entry=0x55584fb5ea00, cmd=cmd@entry=0x55584fb65160 "sh bgp l2vpn evpn route json", matched=matched@entry=0x0, vtysh=vtysh@entry=0)
    at lib/command.c:1257
17 0x00007f17086acc77 in vty_command (vty=vty@entry=0x55584fb5ea00, buf=0x55584fb65160 "sh bgp l2vpn evpn route json") at lib/vty.c:503
18 0x00007f17086ad444 in vty_execute (vty=vty@entry=0x55584fb5ea00) at lib/vty.c:1266
19 0x00007f17086b06c8 in vtysh_read (thread=<optimized out>) at lib/vty.c:2165
20 0x00007f17086a798d in thread_call (thread=thread@entry=0x7ffd17325ce0) at lib/thread.c:2008
21 0x00007f1708660568 in frr_run (master=0x55584f22a120) at lib/libfrr.c:1223
22 0x000055584dfc8c96 in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:555

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-15 12:10:58 -04:00
Donatas Abraitis
4f1e2dcd7a bgpd: Update default-originate route-map actual map structure
If using with `bgp listen range ... peer-group x`, default_rmap[afi][safi] is not
updated, and after the hard-reset in other side, this is flushed and never updated
again without restarting the sender BGP daemon.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-15 13:49:06 +02:00
Alexander Skorichenko
444ce317b2 zebra: fix route deletion during zebra shutdown
Split zebra's vrf_terminate() into disable() and delete() stages.
The former enqueues all events for the dplane thread.
Memory freeing is performed in the second stage.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2024-03-15 11:42:02 +01:00
Francois Dumontet
260bdafd8a tests: bgp_sender_as_path_loop_detection add peer-group test
add a tests of setting as-path-loop-detection through peer-group

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2024-03-15 11:22:57 +01:00
Donatas Abraitis
387a035b66
Merge pull request #15545 from donaldsharp/bgp_attr_dump
bgpd: Add some missing data to `show bgp attribute-info`
2024-03-15 09:43:45 +02:00
sri-mohan1
efbf981d3f zebra: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-03-15 10:30:23 +05:30
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
Francois Dumontet
11d6560104 bgpd: make as-path-loop-detection conform to the framework
currently:
when as-path-loop-detection is set on a peer-group.
members of the peer-group are not using that functionnality.

analysis:
the as-path-loop-detection, is not using the peer's flags
related framework.

fix:
use the peer's flag framework for as-path-loop-detection.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2024-03-14 14:30:51 +01:00
Donald Sharp
bc265804ca bgpd: Add some missing data to show bgp attribute-info
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-14 06:51:45 -04:00
Donald Sharp
894cb4f689 bgpd: When using dev build add pointer information to %pBD
When building FRR with `--enable-dev-build`.  Add a bit of
code to include the pointer value as part of the output.
Helps with tracking down issues and let's us see more data
when using the dev build option.

New output:

2024/03/08 19:48:56 BGP: [V0J1J-W5RHA] 11.0.20.1/32(0x5759ddf8d7c0) for 11.0.20.1/32

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-14 09:45:09 +00:00
Donatas Abraitis
4b512f2f07
Merge pull request #15538 from idryzhov/fix-zebra-warning
zebra: fix compilation warnings
2024-03-14 10:38:24 +02:00
Donatas Abraitis
d1d79f4fa5
Merge pull request #15466 from donaldsharp/bgp_filter_fun
Bgp filter fun
2024-03-14 10:25:14 +02:00
Donatas Abraitis
081f6520ff bgpd: Avoid padding for bgp_paths_limit_capability struct
When sending the packets over the network (dynamic capability) it reports 6 bytes
instead of 5 bytes, and causes some issues between little/big endian machines.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-14 09:50:49 +02:00
Donatas Abraitis
f0686aaa2e
Merge pull request #15501 from donaldsharp/fpm_listener_send_response
Fpm listener send response
2024-03-14 09:05:32 +02:00
Donald Sharp
addff17a55 bgpd: Ensure community data is freed in some cases.
Customer has this valgrind trace:

Direct leak of 2829120 byte(s) in 70728 object(s) allocated from:
  0 in community_new ../bgpd/bgp_community.c:39
  1 in community_uniq_sort ../bgpd/bgp_community.c:170
  2 in route_set_community ../bgpd/bgp_routemap.c:2342
  3 in route_map_apply_ext ../lib/routemap.c:2673
  4 in subgroup_announce_check ../bgpd/bgp_route.c:2367
  5 in subgroup_process_announce_selected ../bgpd/bgp_route.c:2914
  6 in group_announce_route_walkcb ../bgpd/bgp_updgrp_adv.c:199
  7 in hash_walk ../lib/hash.c:285
  8 in update_group_af_walk ../bgpd/bgp_updgrp.c:2061
  9 in group_announce_route ../bgpd/bgp_updgrp_adv.c:1059
 10 in bgp_process_main_one ../bgpd/bgp_route.c:3221
 11 in bgp_process_wq ../bgpd/bgp_route.c:3221
 12 in work_queue_run ../lib/workqueue.c:282

The above leak detected by valgrind was from a screenshot so I copied it
by hand.  Any mistakes in line numbers are purely from my transcription.
Additionally this is against a slightly modified 8.5.1 version of FRR.
Code inspection of 8.5.1 -vs- latest master shows the same problem
exists.  Code should be able to be followed from there to here.

What is happening:

There is a route-map being applied that modifes the outgoing community
to a peer.  This is saved in the attr copy created in
subgroup_process_announce_selected.  This community pointer is not
interned.  So the community->refcount is still 0.  Normally when
a prefix is announced, the attr and the prefix are placed on a
adjency out structure where the attribute is interned.  This will
cause the community to be saved in the community hash list as well.
In a non-normal operation when the decision to send is aborted after
the route-map application, the attribute is just dropped and the
pointer to the community is just dropped too, leading to situations
where the memory is leaked.  The usage of bgp suppress-fib would
would be a case where the community is caused to be leaked.
Additionally the previous commit where an unsuppress-map is used
to modify the outgoing attribute but since unsuppress-map was
not considered part of outgoing policy the attribute would be dropped as
well.  This pointer drop also extends to any dynamically allocated
memory saved by the attribute pointer that was not interned yet as well.

So let's modify the return case where the decision is made to
not send the prefix to the peer to always just flush the attribute
to ensure memory is not leaked.

Fixes: #15459
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 19:28:11 -04:00
Donald Sharp
6814401c47 bgpd: Include unsuppress-map as a valid outgoing policy
If unsuppress-map is setup for outgoing peers, consider that
policy is being applied as for RFC 8212.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 19:28:11 -04:00
Donald Sharp
e613e12f12 bgpd: Ensure that the correct aspath is free'd
Currently in subgroup_default_originate the attr.aspath
is set in bgp_attr_default_set, which hashs the aspath
and creates a refcount for it.  If this is a withdraw
the subgroup_announce_check and bgp_adj_out_set_subgroup
is called which will intern the attribute.  This will
cause the the attr.aspath to be set to a new value
finally at the bottom of the function it intentionally
uninterns the aspath which is not the one that was
created for this function.  This reduces the other
aspath's refcount by 1 and if a clear bgp * is issued
fast enough the aspath for that will be removed
and the system will crash.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 19:28:11 -04:00
Jafar Al-Gharaibeh
75bd2716cf
Merge pull request #15532 from opensourcerouting/fix/vrf_default_originate
bgpd: Check the route and the nexthop appropriately when validating NH
2024-03-13 16:44:03 -05:00
Donatas Abraitis
6ff16b3439 tests: Check if Paths-Limit capability is working dynamically
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-13 16:50:06 +02:00
Donatas Abraitis
56a23f056c bgpd: Set Paths Limit to 0 instead of unsetting the capability
The capability should be untouched, and send 0 (unlimited) instead.

Otherwise, we miss the capability and things are broken later until the
session reset.

Fixes: 72f0e06824 ("bgpd: Implement Paths-Limit capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-13 16:48:54 +02:00
Donatas Abraitis
5f50359c8a bgpd: Show Addpath capability TX/RX flags unconditionally
It's very annoying when testing and instead of looking for true/false, you
have to check if the field exists.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-13 16:48:54 +02:00
Mark Stapp
97f4adfcf9
Merge pull request #15531 from donaldsharp/ospf6_list
eigrpd, mgmtd, ospf6d: frr_fini is last
2024-03-13 08:39:26 -04:00
Donatas Abraitis
caefee3571
Merge pull request #15526 from sri-mohan1/srib-24-zebra-a
zebra: changes for code maintainability
2024-03-13 12:41:07 +02:00
Donatas Abraitis
778357e9ef bgpd: Check the route and the nexthop appropriately when validating NH
A route and its nexthop might belong to different VRFs. Therefore, we need
both the bgp and bgp_nexthop pointers.

Fixes: 8d51fafdcb ("bgpd: Drop bgp_static_update_safi() function")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-13 09:39:22 +02:00
Donald Sharp
cca4bb6527 zebra: Add ability to pretend routes are offloaded
In the fpm_listener add a -r option to allow for
routes to be notified back to zebra that the route
has been `offloaded` properly.

fpm_listener output:
New route 4.5.6.7/32, Prot: Static(196), Metric: 20, nhgid: 23
  Route Static(196) reflecting back
FPM message - Type: 1, Length 56
New route 169.254.0.0/16, Prot: Kernel(2), Metric: 20, nhgid: 2
FPM message - Type: 1, Length 56
New route 192.168.99.0/24, Prot: Kernel(2), Metric: 20, nhgid: 42
FPM message - Type: 1, Length 56
New route 192.168.99.1/32, Prot: Kernel(2), Metric: 20, nhgid: 42
FPM message - Type: 1, Length 56
New route 192.168.119.0/24, Prot: OSPF(188), Metric: 20, nhgid: 20
  Route OSPF(188) reflecting back

Zebra output:

2024-03-06 21:48:54.613 [DEBG] zebra: [TJXPZ-RC5XQ] default(0:254):4.5.6.7/32 Processing dplane notif ctx 0x7160b4008780
2024-03-06 21:48:54.613 [DEBG] zebra: [TJXPZ-RC5XQ] default(0:254):192.168.119.0/24 Processing dplane notif ctx 0x7160b4008780

eva# show ip route 4.5.6.7 json
{
  "4.5.6.7/32":[
    {
      "prefix":"4.5.6.7/32",
      "prefixLen":32,
      "protocol":"static",
      "vrfId":0,
      "vrfName":"default",
      "selected":true,
      "destSelected":true,
      "distance":1,
      "metric":0,
      "installed":true,
      "offloaded":true,
....

and

eva# show ip route 192.168.119.0 json
{
  "192.168.119.0/24":[
    {
      "prefix":"192.168.119.0/24",
      "prefixLen":24,
      "protocol":"ospf",
      "vrfId":0,
      "vrfName":"default",
      "selected":true,
      "destSelected":true,
      "distance":110,
      "metric":100,
      "installed":true,
      "offloaded":true,
...

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 07:38:28 +00:00
Donald Sharp
4676c23cd8 zebra: fpm_listener start adding data about nexthops
Start some very small bit of work into the fpm_listener
about RTM_NEWNEXTHOPS.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 07:38:28 +00:00
Donald Sharp
58c53ab5ba zebra: Add some additional known protocols for fpm_listener
Just add a few more of the known protocols.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 07:38:27 +00:00
Donald Sharp
eedbadf606 eigrpd, mgmtd, ospf6d: frr_fini is last
I noticed that ospf6d always had a linked list memory leak.
Tracking it down shows that frr_fini() shuts down the memory
system and prints out memory not cleaned up.  eigrpd, mgmtd
and ospf6d all called cleanup functions after frr_fini leaving
memory leaked that was not really leaked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-13 07:09:10 +00:00
Igor Ryzhov
3280d81cc9 zebra: fix compilation warnings
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-13 07:08:44 +00:00
Donatas Abraitis
a3df790eb2
Merge pull request #15539 from donaldsharp/cleanup_leaky_sieve
zebra: Cleanup leaked memory on shutdown from GR code
2024-03-13 09:07:57 +02:00
Donald Sharp
9ef76cff98 zebra: Cleanup leaked memory on shutdown from GR code
Recent commit: 6b2554b94a
Exposed, via Address Sanitation, that memory was being
leaked.  Unfortunately the CI system did not catch this.

Two pieces of memory were being lost: The zserv client
data structure as well as anything on the client->gr_info_queue.
Clean these up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-12 21:18:02 -04:00
Russ White
dfa27764a2
Merge pull request #15457 from opensourcerouting/fix/docker_builds_for_10.0
docker: Fix build for Alpine Linux after the recent changes since 9.1
2024-03-12 09:52:39 -04:00
sri-mohan1
19a0211b73 zebra: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-03-12 12:00:12 +05:30
Donatas Abraitis
1942951ea4
Merge pull request #15523 from donaldsharp/lib_mtype_cleanup
Lib mtype cleanup
2024-03-12 07:14:10 +01:00
Donald Sharp
a67e159e3b lib: Remove MTYPE_SYSREPO it is not used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-11 16:52:51 -04:00
Donald Sharp
ad1722cedd lib: Remove unused MTYPE_MSG_NATIVE_MSG
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-11 16:52:21 -04:00
Donald Sharp
beb2ebadb3 lib: Remove unused mtypes from affinitymap.c
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-11 16:07:14 -04:00
Donald Sharp
6b2554b94a zebra: Clean up leaked linklist data structure on shutdown
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-11 16:05:56 -04:00
Mark Stapp
d0afa12467
Merge pull request #15411 from raja-rajasekar/rajasekarr/backpressure_bgp_zebra_zserv
zebra: backpressure - Zebra push back on Buffer/Stream creation
2024-03-11 16:04:13 -04:00
Donald Sharp
c5ecee63ac
Merge pull request #15517 from idryzhov/fix-yang-notif-actions
lib: fix initialization of northbound nodes
2024-03-11 15:47:17 -04:00
Donald Sharp
22dabe1556 lib: Remove unused memory types
These are never used.  So let's remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-03-11 13:04:09 -04:00