summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_vrf.h
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-11 17:42:50 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-06-12 14:10:28 +0200
commita41c4e1b1f577443ad26222704a69649c280cd9e (patch)
tree2d01484bb959675b20c1596be1c1f4e28ddaf403 /zebra/zebra_vrf.h
parentlib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf()... (diff)
downloadfrr-a41c4e1b1f577443ad26222704a69649c280cd9e.tar.xz
frr-a41c4e1b1f577443ad26222704a69649c280cd9e.zip
*: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_vrf.h')
-rw-r--r--zebra/zebra_vrf.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h
index 972fe381c..1b8766950 100644
--- a/zebra/zebra_vrf.h
+++ b/zebra/zebra_vrf.h
@@ -193,6 +193,15 @@ static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf)
return zvrf->vrf->vrf_id;
}
+static inline struct zebra_vrf *zvrf_info_lookup(struct vrf *vrf)
+{
+ struct zebra_vrf *zvrf = NULL;
+
+ if (vrf)
+ zvrf = (struct zebra_vrf *)vrf->info;
+ return zvrf;
+}
+
static inline const char *zvrf_ns_name(struct zebra_vrf *zvrf)
{
if (!zvrf->vrf || !zvrf->vrf->ns_ctxt)