summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-11-12 14:17:14 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-11-19 07:47:19 -0500
commit88b6b28ef33ff3c80ca4504c882735d3847279fc (patch)
tree53d7dbbe991386c50bfbd6fa0915124e223b5bff
parentf573ec607ce0ebcab1282edd4e35756f6d6e6de7 (diff)
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 <sharpd@cumulusnetworks.com>
-rw-r--r--ospfd/ospfd.c8
-rw-r--r--ospfd/ospfd.h1
2 files changed, 9 insertions, 0 deletions
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 */