Commit Graph

5340 Commits

Author SHA1 Message Date
Donald Sharp
dfbccb4cb8
Merge pull request #13681 from LabNConsulting/chopps/bad-abstract2
lib: mgmtd: remove backend abstraction layer and other cleanup
2023-06-05 07:53:31 -04:00
Christian Hopps
7aecb8639c lib: mgmtd: remove abstraction layer and other cleanup
Code is no longer using a global FE "client context", and instead
creates client objects, rename the structure and it's uses to reflect this.

Remove an obfuscating abstraction layer whose existence was entirely
based on using a uintptr_t rather than a pointer to an declared-only struct.

Change multi-duty "params" structure into a single duty callbacks one.

Remove unsupported API code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-04 16:41:24 -04:00
Christian Hopps
65256cd8f7 lib: mgmtd: remove obfuscating abstraction layer and other cleanup
Remove an obfuscating abstraction layer whose existence was entirely
based on using a uintptr_t rather than a pointer to an declared-only struct.

As the code is no longer using a global FE "client context", and instead
create client objects, rename the structure and it's uses to reflect this.

Change init "params" structure into a single use callbacks one.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-04 16:38:19 -04:00
Yuan Yuan
f8aa257997 lib: fix vtysh core when handling questionmark
When issue vtysh command with ?, the initial buf size for the
element is 16. Then it would loop through each element in the cmd
output vector. If the required size for printing out the next
element is larger than the current buf size, realloc the buf memory
by doubling the current buf size regardless of the actual size
that's needed. This would cause vtysh core when the doubled size
is not enough for the next element.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
2023-05-31 20:30:03 +00:00
Donatas Abraitis
147c7a2de3
Merge pull request #13631 from donaldsharp/fix_some_ping_issues
various issues
2023-05-30 21:26:24 +03:00
Christian Hopps
51941c1916 mgmtd: address review comments
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
8611886d52 mgmtd: fix clang uninit warning
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
52a50ca1d7 lib: mgmtd: fix memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
5ba5613077 lib: mgmtd: add manual vty server start option and use it
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
e13a5c4165 lib: mgmtd: fixes for startup config file processing
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:19 -04:00
Christian Hopps
a1d8c7a36e mgmtd: fix reading of config file[s]
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:44 -04:00
Donald Sharp
46d725f76b lib, zebra: Ensure that the ifp->node exists
On removal, ensure that the ifp->node is set to a null
pointer so that FRR does not use data after freed.
In addition ensure that the ifp->node exists before
attempting to free it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-28 10:13:16 -04:00
Christian Hopps
edafa64c30 lib: enable short circuit for FE client/adapter connection
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
218625aa43 mgmtd: lib: cleanup error and debug messages
- always use IDs not a mix of IDs and pointers.
- always use PRIu64 not a mix of hex and decimal for IDs

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
42f4bb2b1a mgmtd: lib: move INIT to after client registers
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
5f05ff5821 lib: add short-circuit operation between same process
- Use a socketpair for connection, and direct (no event loop)
message sending and handling.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
08e8019c65 lib: mgmtd: add a identifying tag to the debug message
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
d6665cf63f lib: dont be tricky with session_id just make it a session_id
- Previously was substituting a pointer to local allocated session for the
session_id returned from the FE adapter. This complexity isn't needed.
- Get rid of "%llu" format and the casts that came with it, instead use PRIu64
and the actual (uint64_t) type.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
99564edc43 lib: mgmtd: add server-side connection code to mgmt_msg
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
070c5e7a91 lib: msg: refactor common connection code from mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
528b326616 lib: mgmt msg: add version to messages
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
fff34d7274 lib: remove write-on-off, just requeue to the back of the queue
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Russ White
575a0c5e3c
Merge pull request #13555 from LabNConsulting/aceelindem/ospf-p2mp-delayed-reflooding-config
ospfd: OSPF P2MP Delayed Reflooding configuration
2023-05-23 11:41:35 -04:00
Russ White
7b7da41def
Merge pull request #13556 from donaldsharp/token_to_desc
memory desciprtion shortening
2023-05-23 08:21:51 -04:00
Acee
0d8ef0477c ospfd: OSPF P2MP Delayed Reflooding configuration
Currently, delayed reflooding on P2MP interfaces for LSAs received
from neighbors on the interface is unconditionally (see commit
c706f0e32b). In some cases, this
change wasn't desirable and this feature makes delayed reflooding
configurable for P2MP interfaces via the CLI command:
"ip ospf network point-to-multipoint delay-reflood" in interface
submode.

Signed-off-by: Acee <aceelindem@gmail.com>
2023-05-22 15:51:41 -04:00
Donald Sharp
d9dfbab71c lib: va_end must be called
According to the man page a va_start must be followed by
a va_end before the end of the function.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-22 10:52:54 -04:00
Donald Sharp
df6eb0bd7b lib, mgmtd: Use short memory names so they fit within vty output
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-19 21:31:35 -04:00
Donald Sharp
b6ab009b99 lib: Fix overlapping memory type
Make a unique memory type so we are not overlapping another one.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-19 21:31:35 -04:00
Donatas Abraitis
a8bc67a989
Merge pull request #13369 from samanvithab/bgpd_fix
lib : fix duplicate prefix list delete
2023-05-18 10:24:41 +03:00
Russ White
425fc1f5b7
Merge pull request #12949 from opensourcerouting/ospf-unplanned-gr
OSPF GR for unplanned outages
2023-05-16 08:37:19 -04:00
David Lamparter
cf0eeb3dc1
Merge pull request #12050 from LabNConsulting/working/lb/topotest-220909 2023-05-16 08:31:06 +02:00
Lou Berger
4d28aea958 lib: when running as a daemon, only redirect sdtin, stdout, sdterr to null when a tty.
Also write memstat to stderr when stderr is not a tty
     and allow for --log stdout

Signed-off-by: Lou Berger <lberger@labn.net>
2023-05-11 07:38:25 -04:00
Donatas Abraitis
1c035c8c2c bgpd: Implement match source-protocol for route-maps
The main idea is to filter routes by matching source (originating) protocol
for outgoing direction. For instance, filter outgoing routes to an arbitrary
router that are static only. Or filter out only routes learned from RIP.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-11 11:39:23 +03:00
Samanvitha B Bhargav
394ed767e7 lib : fix duplicate prefix list delete
Problem statement:
Step-1:
pl1 - 10.10.10.10/24 with deny sequence 1
Step-2:
pl1 - 10.10.10.10/24 with permit sequence 2
Step-3:
pl1 - 20.20.20.20/24 with deny sequence 1

Now we end up deleting permit sequence 2,
which might blackhole the traffic.

RCA:
Whenever we have multiple prefix lists,
having same prefix and different subnet range,
delete or replace of prefix list
would result in delete of entry in route-map
prefix table.

Fix:
We will skip deleting prefix list entry
from routemap prefix table, if we have
the multiple prefix lists having same prefix.

Signed-off-by: Samanvitha B Bhargav <bsamanvitha@vmware.com>
2023-05-09 02:23:44 -07:00
Renato Westphal
0c05ceae00 ospfd, ospf6d: introduce the "graceful-restart hello-delay" command
This command makes unplanned GR more reliable by manipulating the
sending of Grace-LSAs and Hello packets for a certain amount of time,
increasing the chance that the neighboring routers are aware of
the ongoing graceful restart before resuming normal OSPF operation.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 21:47:44 -03:00
Mark Stapp
eb4c026d13
Merge pull request #13413 from chiragshah6/fdev2
zebra: re-install NHG on interface up
2023-05-08 14:36:07 -04:00
Ashwini Reddy
5bb87732f6 zebra: re-install nhg on interface up
Intermittently zebra and kernel are out of sync
when interface flaps and the add's/dels are in
same processing queue and zebra assumes no change in nexthop.
Hence we need to bring in a reinstall to kernel
of the nexthops and routes to sync their states.

Upon interface flap kernel would have deleted NHGs
associated to a interface (the one flapped),
zebra retains NHGs for 3 mins even though upper
layer protocol removes the nexthops (associated NHG).
As part of interface address add ,
re-add singleton NHGs associated to interface.

Ticket: #3173663
Issue: 3173663

Signed-off-by: Ashwini Reddy <ashred@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-05-05 14:37:52 -07:00
Christian Hopps
3701780a15 lib: log commands read from config file
When the user specifies `--command-log-always` in CLI arguments then also log
commands executed from loading the config file.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-04 14:48:59 -04:00
Russ White
d0053da26b
Merge pull request #13376 from louis-6wind/fix-flex-algo-mem-leak
isisd, lib: fix flex-algo memory leak
2023-05-02 11:33:38 -04:00
Russ White
b9f0c8c8d0
Merge pull request #13404 from louis-6wind/fix-flex-algo-race-condition
isisd: fix a flex algo race condition and a minor fix
2023-05-02 10:42:39 -04:00
Russ White
9ab0661b89
Merge pull request #13235 from Orange-OpenSource/link-state
lib: Fix memory leaks in Link State library
2023-05-02 10:31:10 -04:00
Donald Sharp
0313343d0a
Merge pull request #13395 from LabNConsulting/chopps/mgmtd-debug-flags
mgmtd: fully implement debug flags for mgmtd and clients
2023-05-02 08:17:17 -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
Christian Hopps
6b7481aa8d lib: add build option to set startup log timestemp precision
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-29 02:36:06 -04:00
Louis Scalbert
cc1f9bd9e2 lib: fix comparaison of flex-algo definition
Fix comparaison of flex-algo definition by comparing all the definition
statements.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-28 11:53:18 +02:00
Louis Scalbert
3f55b8c621 isisd: fix disabled flex-algo on race condition
A particular flex-algo algorithm may remain in disabled state after
configuring it if its flex-algo definition is being spread in the area.

It happens sometimes that, in isis_sr_flex_algo_topo1 topotest, r3
flex-algo 203 is disabled on test8. It depends on the following
sequence on r3:
 1. a LSP containing the flex-algo 203 definition is received from
    either r1 or r2 (or both).
 2. the local LSP is rebuilt by lsp_build() because of the flex-algo 203
    configuration
 3. isis_run_spf() recomputes the algo 203 SPF tree

A 1. 2. 3. sequence results in a working test whereas 2. 1. 3. is not
working. The second case issue is because of an inconsistent flex-algo
definition state between the following:
 - in lsp_build(), isis_flex_algo_elected_supported_local_fad() returns
   false because no flex-algo definition is known.
 - in isis_run_spf(), isis_flex_algo_elected_supported() returns true
   because a flex-algo definition is found.

Set a flex-algo state lsp_build() depending on flex-algo definition
existence that is used later in isis_run_spf().

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-28 11:53:18 +02:00
Louis Scalbert
5c28462596 isisd, lib: clarify sizeof on flex-algo memory allocation
Use the struct instead of the pointer for flex-algo memory allocation.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-27 15:39:21 +02:00
Louis Scalbert
87acad8698 isisd, lib: fix flex-algo database memory leak at area destruction
Free flex-algorithm database memory when an IS-IS area is destroyed.

Fixes: 735fb37db1 ("lib: add library for igp flexible-algorithm")
Fixes: 7f198e063c ("isisd: add isis flex-algo base interface")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-27 15:37:36 +02:00
Louis Scalbert
5b3e0735cc lib: dispatch flex_algo_delete()
Dispatch flex_algo_delete() to prepare the next commit. Cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-27 15:36:15 +02:00
Louis Scalbert
8766fceefc lib: move flex_algo_delete() just after flex_algo_alloc()
Move flex_algo_delete() just after flex_algo_alloc(). No change on code.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-27 15:35:56 +02:00