]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Print '*' for INADDR_ANY
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 27 Sep 2016 15:06:12 +0000 (11:06 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:10 +0000 (20:26 -0500)
When INADDR_ANY is sent to the pim dump function, return "*"

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_str.c

index ca635c8a54bd938571e454438662ab75f7a7f692..2dffe8c2b8908fed938147c0692c8e6afe579125 100644 (file)
@@ -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;