lib/prefix.[ch]: add family2str()

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
This commit is contained in:
G. Paul Ziemba 2018-03-28 09:56:45 -07:00
parent ce7b915214
commit db2fde34d3
2 changed files with 16 additions and 0 deletions

View File

@ -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)
{

View File

@ -290,6 +290,7 @@ static inline void ipv4_addr_copy(struct in_addr *dst,
extern int str2family(const char *);
extern int afi2family(afi_t);
extern afi_t family2afi(int);
extern const char *family2str(int family);
extern const char *safi2str(safi_t safi);
extern const char *afi2str(afi_t afi);