diff options
author | Christian Hopps <chopps@labn.net> | 2023-02-24 02:23:51 +0100 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-02-24 02:59:17 +0100 |
commit | 41ef7327e3ebf9f0293c6046190aceb9d44f8414 (patch) | |
tree | 76bac8831c49014cdb6edf1698a4b6851623c490 /lib/northbound_grpc.cpp | |
parent | Merge pull request #12876 from opensourcerouting/fix/align_show_bgp_with_conf... (diff) | |
download | frr-41ef7327e3ebf9f0293c6046190aceb9d44f8414.tar.xz frr-41ef7327e3ebf9f0293c6046190aceb9d44f8414.zip |
lib: fix init. use of nb_context to be by value not by reference
Pass context argument by value on initialization to be clear that the
value is used/saved but not a pointer to the value. Previously the
northbound code was incorrectly holding a pointer to stack allocated
context structs.
However, the structure definition also had some musings (ifdef'd out
code) and a comment that might be taken to imply that user data could
follow the structure and thus be maintained by the code; it won't; so it
can't; so get rid of the disabled misleading code/text from the
structure definition.
The common use case worked b/c the transaction which cached the pointer
was created and freed inside a single function
call (`nb_condidate_commit`) that executed below the stack allocation.
All other use cases (grpc, confd, sysrepo, and -- coming soon -- mgmtd)
were bugs.
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/northbound_grpc.cpp')
-rw-r--r-- | lib/northbound_grpc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index f5d59d92d..1459146ea 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -824,7 +824,7 @@ HandleUnaryCommit(UnaryRpcState<frr::CommitRequest, frr::CommitResponse> *tag) case frr::CommitRequest::PREPARE: grpc_debug("`-> Performing PREPARE"); ret = nb_candidate_commit_prepare( - &context, candidate->config, comment.c_str(), + context, candidate->config, comment.c_str(), &candidate->transaction, errmsg, sizeof(errmsg)); break; case frr::CommitRequest::ABORT: @@ -840,7 +840,7 @@ HandleUnaryCommit(UnaryRpcState<frr::CommitRequest, frr::CommitResponse> *tag) break; case frr::CommitRequest::ALL: grpc_debug("`-> Performing ALL"); - ret = nb_candidate_commit(&context, candidate->config, true, + ret = nb_candidate_commit(context, candidate->config, true, comment.c_str(), &transaction_id, errmsg, sizeof(errmsg)); break; |