summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorG. Paul Ziemba <paulz@labn.net>2018-03-28 18:56:45 +0200
committerG. Paul Ziemba <paulz@labn.net>2018-04-04 18:24:17 +0200
commitdb2fde34d3be4a20eed9e6b5cad92bfea2b471fa (patch)
treeea85fef4555528567d6c67f9e354ce1d5e8c1ac8 /lib/prefix.c
parentMerge pull request #1993 from vivek-cumulus/evpn-fixes (diff)
downloadfrr-db2fde34d3be4a20eed9e6b5cad92bfea2b471fa.tar.xz
frr-db2fde34d3be4a20eed9e6b5cad92bfea2b471fa.zip
lib/prefix.[ch]: add family2str()
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index ed55fac88..b38dd9458 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -467,6 +467,21 @@ int str2family(const char *string)
return -1;
}
+const char *family2str(int family)
+{
+ switch (family) {
+ case AF_INET:
+ return "IPv4";
+ case AF_INET6:
+ return "IPv6";
+ case AF_ETHERNET:
+ return "Ethernet";
+ case AF_EVPN:
+ return "Evpn";
+ }
+ return "?";
+}
+
/* Address Famiy Identifier to Address Family converter. */
int afi2family(afi_t afi)
{