lib: in event lib replace array of regular fds with listReplace the fixed-size array of regular file fds with a
list. This simplifies the management of the fds, and avoids
some potentially costly searching and memmove'ing.
Signed-off-by: Mark Stapp <mjs@cisco.com>
tests: unit-test: add rpc to test modulePreviously was only testing an action. Add RPC w/o args and w/ args to unit
tests.
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: fix coverity #1667683Coverity traces the free into txn_req_free() but fails to also understand the
TAILQ_REMOVE() in that function, so it thinks we are freeing the same
`tqh_first` element over and over again. :(
Signed-off-by: Christian Hopps <chopps@labn.net>
lib: fix coverity #1644729Check the `transaction->config` non-NULL prior to passing `transaction` to
`nb_db_transaction_save()` as it assumes `config` is non-NULL.
Signed-off-by: Christian Hopps <chopps@labn.net>
lib: fix coverity #1641463Use asserts and casts to inform SA to clear warning. Document valid return
values as well.
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: fix coverity #1667704Was calling strerror() with negative errno value. It's always just none or
-EBUSY so just elide this altogether.
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: add restconf flag to RPC APIsFor RPCs, RESTCONF uses a different input/output data format. This needs to be
flagged when calling libyang functions etc, so pass a restconf bool around to
identify when this is the case.
Signed-off-by: Christian Hopps <chopps@labn.net>
docker: build/install latest libyang3 in ubuntu test container- The upstream has moved to version 4. Let's update to the latest V3 for now.
Signed-off-by: Christian Hopps <chopps@labn.net>
lib,bgpd,pathd: move frrevent internals into event moduleMove the core frrevent structs out of the public header file
and into the event lib module. Add a couple of accessor or
helper functions for internal fields; replace direct use of
the structs' fields with the new helper functions.
Signed-off-by: Mark Stapp <mjs@cisco.com>
bgpd: fix peer type for route-map during VRF route leakingUse the original route's peer instead of peer_self when applying
route-maps in VRF-to-VRF leaking. This preserves the original peer
type (e.g., BGP_PEER_EBGP) so that route-map commands like
'set as-path exclude' work correctly.
Previously, info.peer was always set to peer_self which has
BGP_PEER_UNSPECIFIED, causing peer-type dependent route-map
commands to be skipped.
Signed-off-by: Soumya ...
test: Add test for vrf route leak with AS path strippingAdd test to verify route leaking with AS path manipulation
using 'set as-path exclude'.
Signed-off-by: Soumya Roy <souroy@nvidia.com>
bgpd: Fix Coverity issue after 19506In bgp_label.c I've set label_pnt to &label after maximum number of
array elements were written. For simplicity there was still label_pnt++,
so Coverity didn't like incrementing pointer to local variable.
I refactored `bgp_nlri_get_labels` not to use such code: added index
variable for array, in each iteration label_pnt is set either to i-th
element of array or to &label. It is never used as p...
bgpd: Check length for dynamic capability (software version new encoding)If an old encoding is used, we should check len + 1 (1 byte is for the extra
length field), while using the new encoding, it's not needed, because this is
already in hdr->length (capability's length).
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
mgmtd: fixes post reorganization- Need to consider req_id 0 from client commit reply.
- Also need to decide to free init and rollback txn earlier to avoid after free
access.
- Placate clang SA NULL ptr deref. The code is fine as the only way clients
get's set with an ID bit is from earlier which did the darr_ensure_i() but
clang can't follow that far enough back, so we do another darr_ensure_i()
which is close to free...
mgmtd: reorganize and cleanup the codeTXN:
Organize the code into separate functional sections.
Move config txn code into it's own file (`mgmt_txn_cfg.c`). While it has been
simplified (5 states to 3, ...), it's still worth sitting alone which really
helps comprehension.
Normalize naming e.g., `mgmt_txn_` and `txn_` for non-config global and static
items, `mgmt_txn_cfg_` and `txn_cfg_` for config global and static it...
mgmtd: move mgmt vty code out of share lib and into mgmtdMgmtd hooks into the normal (legacy) vty code to send CLI changes to itself
using the mgmtd front-end API. These changes are passed downstream to the
daemons). This code was embedded in lib/vty.c and so it was uselessly included
in every daemon (and made the vty code harder to understand).
Move the mgmtd vty code out of lib/vty.c and into mgmtd proper.
Similarly handled is the inline northbou...
mgmtd: backend cleanup, remove locks and unused functions- Remove unused ref-counting (lock/unlock) nothing even holds these ref-counts
except the object itself.
- Remove lookup by name, nothing uses it.
- Remove search for old adapter connection just use the id-indexed array.
- Switch to queue.h
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: remove unneeded lock/unlock (ref-count) on front-end adaptersFE client adapters have a list of sessions. If the adapter is deleted the
sessions are deleted. If a session is deleted it is removed from the adapter
list.
That's it, there's no reason for ref-counting here so get rid of it.
Switch to queue.h
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: front-end locking and candidate restore cleanup- Add TXN locks for config txn's. Previously only the session held the locks on
the candidate and running DS's. This means the DS's could be unlocked (e.g., on
a session disconnect) while in the middle of a config change (e.g., sending to
backends) which then later would have mgmtd copying candidate over running w/o
any locks (or worse with something else holding locks).
- Harden the DS locks ...
mgmtd: rename MGMT_TXN_LOCK to TXN_INCREFThe LOCK naming for the ref counting on txn's was confusing given mgmtd also
managing locks on datastores. Change to INCREF and DECREF.
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: standardize the clients sent and clients wait logic- make rpc and get-data the same as config for checking on replies from
backend clients (unset waiting-for bits vs setting received-reply bits).
Signed-off-by: Christian Hopps <chopps@labn.net>
mgmtd: txn: refactor txn req structsPreviously we had all the txn-request specific data included in the generic
txn_req structure using a union which required they all be defined before the
common txn_req struct.
We want to split the config out into a different file and so it makes sense to
not have to define all the type-specific request data before the common txn_req
data.
Instead use the standard approach of using a common h...
mgmtd: simplify the config code/state machineSimplify the configuration commit process.
- Remove an explicit TXN create and delete handshake with the backend daemons.
Now we just pass a txn-id when we send the config -- the backends can create
there own txn tracker with the given config -- and then we send either "apply"
or "delete" (abort) with that txn-id. The backend will cleanup it's txn state
then.
So instead of 4 exchanges (create...
lib: adapt mgmtd backend client code to simplification changesThe new API removes explicit TXN creation message. Config transactions are now
created when the CFG_REQ message is received if it succeeds.
TXNs are implicitly deleted after processing a CFG_APPLY message. TXN delete is
still used to abort the CFG_REQ changes if they should not be applied.
So changes are successful path is:
1) mgmtd: sends CFG_REQ with txn-id and changes to client
2a) clie...
bgpd: Add BGP FSM and session tracing with conditional fsm_eventAdd comprehensive tracing for BGP peer events including
- session state changes,
- connection attempts, and
- FSM transitions.
Only trace FSM events when state actually changes to avoid redundancy.
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
topotests: Fix test to expect link-local NH after GUA removalUpdate test_configure_gua_on_unnumbered_intf to expect link-local
nexthop (fe80::) instead of buggy IPv4-mapped address (::ffff:)
when GUA is removed from unnumbered interface.
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>