summaryrefslogtreecommitdiffstats
path: root/lib/northbound_confd.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-04-27 18:13:57 +0200
committerRenato Westphal <renato@opensourcerouting.org>2020-05-29 00:22:54 +0200
commit13d6b9c1343a1f925e3ffd7be0938bf1f395b461 (patch)
tree93f50208c9c3e0403fb01b697234b815f7889a50 /lib/northbound_confd.c
parentlib: northbound style fixes (diff)
downloadfrr-13d6b9c1343a1f925e3ffd7be0938bf1f395b461.tar.xz
frr-13d6b9c1343a1f925e3ffd7be0938bf1f395b461.zip
lib: introduce the northbound context structure
The new northbound context structure contains information about the client performing a configuration transaction. This information will be made available to all configuration callbacks through the args->context parameter. The usefulness of this structure comes from the fact that it can be used as a communication channel (both input and output) between the northbound callbacks and the northbound clients. This can be done through its "client_data" field which contains client-specific data. This should cover some very specific scenarios where a northbound callback should perform an action only if the configuration change is coming from a given client. An example would be sending a PCEP response to a PCE when an SR-TE policy is created or modified through the PCEP northbound client (for that to happen, the northbound callbacks need to have access to the PCEP request ID, which needs to be available). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/northbound_confd.c')
-rw-r--r--lib/northbound_confd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c
index 2fc3c81cf..50daa62e5 100644
--- a/lib/northbound_confd.c
+++ b/lib/northbound_confd.c
@@ -285,6 +285,7 @@ frr_confd_cdb_diff_iter(confd_hkeypath_t *kp, enum cdb_iter_op cdb_op,
static int frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen)
{
+ struct nb_context context = {};
struct nb_config *candidate;
struct cdb_iter_args iter_args;
int ret;
@@ -321,8 +322,9 @@ static int frr_confd_cdb_read_cb_prepare(int fd, int *subp, int reslen)
* required to apply them.
*/
transaction = NULL;
- ret = nb_candidate_commit_prepare(candidate, NB_CLIENT_CONFD, NULL,
- NULL, &transaction);
+ context.client = NB_CLIENT_CONFD;
+ ret = nb_candidate_commit_prepare(&context, candidate, NULL,
+ &transaction);
if (ret != NB_OK && ret != NB_ERR_NO_CHANGES) {
enum confd_errcode errcode;
const char *errmsg;