]> git.proxmox.com Git - mirror_frr.git/commit
lib: fix init. use of nb_context to be by value not by reference
authorChristian Hopps <chopps@labn.net>
Fri, 24 Feb 2023 01:23:51 +0000 (20:23 -0500)
committerChristian Hopps <chopps@labn.net>
Fri, 24 Feb 2023 01:59:17 +0000 (20:59 -0500)
commit41ef7327e3ebf9f0293c6046190aceb9d44f8414
tree76bac8831c49014cdb6edf1698a4b6851623c490
parentce8194bcd09bebfd2641ffeeb48ad3e8b527182b
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>
lib/libfrr.c
lib/northbound.c
lib/northbound.h
lib/northbound_cli.c
lib/northbound_confd.c
lib/northbound_db.c
lib/northbound_grpc.cpp
lib/northbound_sysrepo.c
lib/vty.c