summaryrefslogtreecommitdiff
path: root/lib/libfrr.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-04-27 13:13:57 -0300
committerRenato Westphal <renato@opensourcerouting.org>2020-05-28 19:22:54 -0300
commit13d6b9c1343a1f925e3ffd7be0938bf1f395b461 (patch)
tree93f50208c9c3e0403fb01b697234b815f7889a50 /lib/libfrr.c
parent1be4decb04be48d73ea90f6feb0f33af25499c19 (diff)
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 ac165f254e..d52cef3fe9 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__);