diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-27 17:06:12 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-22 02:26:10 +0100 |
commit | c0a06968b22154559a8b0bb0bea0de5919de2ca4 (patch) | |
tree | ad1643cdfe74a868575ca8a551939c9b6727c9ca /pimd/pim_str.c | |
parent | pimd: sort pim_ifchannel_list (diff) | |
download | frr-c0a06968b22154559a8b0bb0bea0de5919de2ca4.tar.xz frr-c0a06968b22154559a8b0bb0bea0de5919de2ca4.zip |
pimd: Print '*' for INADDR_ANY
When INADDR_ANY is sent to the pim dump function, return "*"
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_str.c')
-rw-r--r-- | pimd/pim_str.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pimd/pim_str.c b/pimd/pim_str.c index ca635c8a5..2dffe8c2b 100644 --- a/pimd/pim_str.c +++ b/pimd/pim_str.c @@ -47,11 +47,16 @@ void pim_inet4_dump(const char *onfail, struct in_addr addr, char *buf, int buf_ { int save_errno = errno; - if (!inet_ntop(AF_INET, &addr, buf, buf_size)) { - zlog_warn("pim_inet4_dump: inet_ntop(AF_INET,buf_size=%d): errno=%d: %s", - buf_size, errno, safe_strerror(errno)); - if (onfail) - snprintf(buf, buf_size, "%s", onfail); + if (addr.s_addr == INADDR_ANY) + strcpy(buf, "*"); + else + { + if (!inet_ntop(AF_INET, &addr, buf, buf_size)) { + zlog_warn("pim_inet4_dump: inet_ntop(AF_INET,buf_size=%d): errno=%d: %s", + buf_size, errno, safe_strerror(errno)); + if (onfail) + snprintf(buf, buf_size, "%s", onfail); + } } errno = save_errno; |