summaryrefslogtreecommitdiffstats
path: root/lib/libfrr.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/libfrr.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/libfrr.c')
-rw-r--r--lib/libfrr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index ac165f254..d52cef3fe 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -902,11 +902,13 @@ static int frr_config_read_in(struct thread *t)
* reading the configuration file.
*/
if (frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL) {
+ struct nb_context context = {};
int ret;
- ret = nb_candidate_commit(vty_shared_candidate_config,
- NB_CLIENT_CLI, NULL, true,
- "Read configuration file", NULL);
+ context.client = NB_CLIENT_CLI;
+ ret = nb_candidate_commit(&context, vty_shared_candidate_config,
+ true, "Read configuration file",
+ NULL);
if (ret != NB_OK && ret != NB_ERR_NO_CHANGES)
zlog_err("%s: failed to read configuration file.",
__func__);