From: Donald Sharp Date: Tue, 27 Sep 2016 15:06:12 +0000 (-0400) Subject: pimd: Print '*' for INADDR_ANY X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~191 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c0a06968b22154559a8b0bb0bea0de5919de2ca4;p=mirror%2Ffrr.git pimd: Print '*' for INADDR_ANY When INADDR_ANY is sent to the pim dump function, return "*" Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_str.c b/pimd/pim_str.c index ca635c8a54..2dffe8c2b8 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;