From 88b6b28ef33ff3c80ca4504c882735d3847279fc Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 12 Nov 2019 14:17:14 -0500 Subject: [PATCH] ospfd: Add a function to return the name of the vrf we are in. Add a helper function to return the name of the vrf we are in so it can be used as part of debug strings. Signed-off-by: Donald Sharp --- ospfd/ospfd.c | 8 ++++++++ ospfd/ospfd.h | 1 + 2 files changed, 9 insertions(+) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index b12fa63723..5058886f36 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -2173,3 +2173,11 @@ const char *ospf_vrf_id_to_name(vrf_id_t vrf_id) return vrf ? vrf->name : "NIL"; } + +const char *ospf_get_name(const struct ospf *ospf) +{ + if (ospf->name) + return ospf->name; + else + return VRF_DEFAULT_NAME; +} diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index b31ad30375..937d363b4c 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -572,4 +572,5 @@ extern void ospf_vrf_unlink(struct ospf *ospf, struct vrf *vrf); const char *ospf_vrf_id_to_name(vrf_id_t vrf_id); int ospf_area_nssa_no_summary_set(struct ospf *, struct in_addr); +const char *ospf_get_name(const struct ospf *ospf); #endif /* _ZEBRA_OSPFD_H */ -- 2.39.5