diff options
| author | Mark Stapp <mstapp@nvidia.com> | 2021-10-28 11:23:31 -0400 |
|---|---|---|
| committer | Mark Stapp <mstapp@nvidia.com> | 2022-02-25 10:18:32 -0500 |
| commit | cd787a8a45ea3c94a689d5ff01ddf62467373550 (patch) | |
| tree | 6d33a836729d423443dd004ca2eda91933c44ea6 /zebra/interface.c | |
| parent | 728f2017ae285aea6f7e8bda369eaae7a3083899 (diff) | |
zebra: use dataplane to read interface NETCONF info
Use the dataplane to query and read interface NETCONF data;
add netconf-oriented data to the dplane context object, and
add accessors for it. Add handler for incoming update
processing.
Signed-off-by: Mark Stapp <mstapp@nvidia.com>
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 7dd7e49479..c30f43456c 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1318,6 +1318,56 @@ done: dplane_ctx_fini(&ctx); } +/* + * Handle netconf change from a dplane context object; runs in the main + * pthread so it can update zebra data structs. + */ +int zebra_if_netconf_update_ctx(struct zebra_dplane_ctx *ctx) +{ + struct zebra_ns *zns; + struct interface *ifp; + struct zebra_if *zif; + enum dplane_netconf_status_e mpls; + int ret = 0; + + zns = zebra_ns_lookup(dplane_ctx_get_netconf_ns_id(ctx)); + if (zns == NULL) { + ret = -1; + goto done; + } + + ifp = if_lookup_by_index_per_ns(zns, + dplane_ctx_get_netconf_ifindex(ctx)); + if (ifp == NULL) { + ret = -1; + goto done; + } + + zif = ifp->info; + if (zif == NULL) { + ret = -1; + goto done; + } + + mpls = dplane_ctx_get_netconf_mpls(ctx); + + if (mpls == DPLANE_NETCONF_STATUS_ENABLED) + zif->mpls = true; + else if (mpls == DPLANE_NETCONF_STATUS_DISABLED) + zif->mpls = false; + + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: if %s, ifindex %d, mpls %s", + __func__, ifp->name, ifp->ifindex, + (zif->mpls ? "ON" : "OFF")); + +done: + /* Free the context */ + dplane_ctx_fini(&ctx); + + return ret; +} + /* Dump if address information to vty. */ static void connected_dump_vty(struct vty *vty, json_object *json, struct connected *connected) |
