Commit Graph

60 Commits

Author SHA1 Message Date
Donald Sharp
60dc2992c9 mgmtd: Fix up some coverity issues
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-05 07:57:49 -04:00
Donald Sharp
af001e29f9 mgmtd: xpath is already NULL in the failure path
There is no way that xpath can ever be anything but NULL
in the failure path with the goto's.  Let's just remove
the goto's and return immediately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-31 07:54:10 -04:00
Donald Sharp
7470509390
Merge pull request #13632 from LabNConsulting/chopps/mgmt-avoid-race
mgmtd: fix possible race btw read config and backend connection
2023-05-31 07:28:50 -04:00
Christian Hopps
3744ad02d9 mgmtd: fix possible race btw read config and backend connection
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 11:52:19 -04:00
Donald Sharp
9be555f8d4
Merge pull request #13601 from opensourcerouting/build-yang-embed-20230525
build: fix missing YANG model embedding
2023-05-30 11:34:29 -04: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
0327be91d1 mgmtd: cleanup BE xpath subscription and matching code
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
7a0894b532 mgmtd: Add note to SETCFG_REQ and debug logging
- convert impossible situation into assert

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:51 -04:00
Christian Hopps
acd7aea00e mgmtd: simplify early config build removing unused code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:51 -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
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
9405278ef2 mgmtd: send reply to SUBSCR_REQ with success or not
since we don't actually handle xpath subscriptions, reply with fail
if they are requested.

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
bcc350971f mgmtd: fix cleanup of cleanup in FE adapter code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
c193194905 mgmtd: eliminate unused state
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
e3cacd9643 mgmtd: cleanup/fix BE adapter deletion code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
6dad9b53e7 mgmtd: convert BE/FE adapter to use allocated connections
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
David Lamparter
dc3cea95eb mgmtd: embed necessary YANG models
Listing `.c` files in `$(…_OBJECTS):` does not have the desired effect.

(Also CLEANFILES is not needed, yang/subdir.am already has yang/*.c in
CLEANFILES anyway.)

Fixes: #13600
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-05-25 13:47:44 +02: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
Christian Hopps
0030b5825e mgmtd: fix uninit warning and cleanup history error messages
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-18 08:42:42 -04:00
Christian Hopps
d31d24c488 mgmtd: simplify commit id to just be a timeval string
Also fixes coverity warning

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-04 14:47:55 -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
9b96394d05
Merge pull request #13149 from pushpasis/mgmt_cleanup_zlog
mgmtd, lib: Cleanup zlog_err()
2023-04-24 11:00:08 -04:00
Pushpasis Sarkar
048e1e7be8 mgmtd, lib: Cleanup zlog_err()
Cleanup all zlog_err() that were meant for debug only.

Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
2023-04-11 22:48:52 -07:00
rgirada
83b78f43f4 mgmtd: Fixing style warnings
Description:
	Fixing the style warnings in the mgmtd code.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2023-04-05 10:30:24 +00:00
rgirada
93d4e355d8 mgmtd: Fixing code coverity issues in mgmtd
Description:
	the following list of coverity issues seen in mgmtd code.
	1. CID 1536832:  Memory - corruptions  (OVERLAPPING_COPY)
	   /mgmtd/mgmt_history.c: 85 in mgmt_history_create_cmt_rec()
	2. CID 1536831:  Error handling issues  (NEGATIVE_RETURNS)
	   /mgmtd/mgmt_be_server.c: 123 in mgmt_be_server_start()
	3. CID 1536830:  Resource leaks  (RESOURCE_LEAK)
	   /mgmtd/mgmt_history.c: 146 in mgmt_history_read_cmt_record_index()
	4. CID 1536829:  Error handling issues  (NEGATIVE_RETURNS)
	   /mgmtd/mgmt_fe_server.c: 123 in mgmt_fe_server_start()
	5. CID 1536828:  Possible Control flow issues  (DEADCODE)
	   /mgmtd/mgmt_txn.c: 1859 in mgmt_txn_get_config()
	6. CID 1536827:  Null pointer dereferences  (NULL_RETURNS)
           /mgmtd/mgmt_ds.c: 526 in mgmt_ds_delete_data_nodes()

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2023-04-05 10:29:14 +00:00
Jafar Al-Gharaibeh
3b28a5ef6b
Merge pull request #13131 from LabNConsulting/chopps/no-startup-file
mgmtd: remove startup config feature for now
2023-04-04 08:42:04 -05:00
Christian Hopps
8033bf3976 mgmtd: lib: read transitioned daemons split config files in mgmtd
When daemons transition to mgmtd they should stop reading their split config
files, and let mgmtd do that, otherwise things can get out of sync.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-01 18:06:43 -04:00
Donald Sharp
acdb814dfa
Merge pull request #13171 from manojvn/13154_fix
mgmtd: Fix for issue 13154.
2023-04-01 09:18:10 -04:00
Christian Hopps
803829e41e mgmtd: remove startup config feature for now
The startup config and how it interacts with explicit commits,
commit databases and implicit commits needs to be worked out
in design first. For now remove the offending code.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-03-31 15:21:20 -04:00
Manoj Naragund
689e1d447a mgmtd: Fix for issue 13154.
The changes involve adding show debuggin command for MGMTd which resolves
command incomplete issue.

issue #13154

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-03-31 03:47:17 -07:00
Christian Hopps
204e90579c mgmtd: remove errant git added file
fixes #13156

Signed-off-by: Christian Hopps <chopps@gmail.com>
2023-03-31 00:17:09 +00:00
Donald Sharp
4261481c6d mgmtd: Remove unnecessary asserts
event_add_XXXX functions have no failure path where
if you pass in a double event pointer that it could
return without setting the pointer.  As such these
asserts make no sense and are unnecessary

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-27 08:09:42 -04:00
Jafar Al-Gharaibeh
06f54ff416
Merge pull request #12953 from donaldsharp/struct_event
Struct event
2023-03-24 13:48:53 -05:00
Donald Sharp
24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00