diff options
Diffstat (limited to 'pimd/pim_str.c')
-rw-r--r-- | pimd/pim_str.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pimd/pim_str.c b/pimd/pim_str.c index 8e1d7cec2..ca635c8a5 100644 --- a/pimd/pim_str.c +++ b/pimd/pim_str.c @@ -29,6 +29,20 @@ #include "pim_str.h" +void pim_addr_dump (const char *onfail, struct prefix *p, char *buf, int buf_size) +{ + int save_errno = errno; + + if (!inet_ntop(p->family, &p->u.prefix, buf, buf_size)) { + zlog_warn("pim_addr_dump: inet_ntop(buf_size=%d): errno=%d: %s", + buf_size, errno, safe_strerror(errno)); + if (onfail) + snprintf(buf, buf_size, "%s", onfail); + } + + errno = save_errno; +} + void pim_inet4_dump(const char *onfail, struct in_addr addr, char *buf, int buf_size) { int save_errno = errno; |