]> git.puffer.fish Git - mirror/frr.git/commitdiff
[debug] Improve zebra kernel socket debug message to include IP addresses.
authorAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Wed, 17 May 2006 15:04:59 +0000 (15:04 +0000)
committerAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Wed, 17 May 2006 15:04:59 +0000 (15:04 +0000)
2006-05-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

* kernel_socket.c: (ifam_read_mesg) Improve debug message
  to show the IP address.

zebra/ChangeLog
zebra/kernel_socket.c

index 07bf8bab2d4937c95f10e331f339e6853e354ad3..6235071f6e310c328edcd33b9b2ca50371d69949 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * kernel_socket.c: (ifam_read_mesg) Improve debug message
+         to show the IP address.
+
 2006-05-15 Paul Jakma <paul.jakma@sun.com>
 
        * zserv.c: (general) Remove the private zebra_command_str
index 9764cbb374e67a81c2edf24f719a51cad0327532..bd4d9c4bb94eba69625cdef0a462a2a3815154f1 100644 (file)
@@ -510,9 +510,46 @@ ifam_read_mesg (struct ifa_msghdr *ifm,
   RTA_ADDR_GET (brd, RTA_BRD, ifm->ifam_addrs, pnt);
 
   if (IS_ZEBRA_DEBUG_KERNEL)
-      zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x", 
-                  __func__, ifm->ifam_index, 
-                  (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs);
+    {
+      switch (sockunion_family(addr))
+        {
+       case AF_INET:
+         {
+           char buf[2][INET_ADDRSTRLEN];
+           zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x, "
+                       "addr %s/%d broad %s", 
+                       __func__, ifm->ifam_index, 
+                       (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs,
+                       inet_ntop(AF_INET,&addr->sin.sin_addr,
+                                 buf[0],sizeof(buf[0])),
+                       ip_masklen(mask->sin.sin_addr),
+                       inet_ntop(AF_INET,&brd->sin.sin_addr,
+                                 buf[1],sizeof(buf[1])));
+         }
+         break;
+#ifdef HAVE_IPV6
+       case AF_INET6:
+         {
+           char buf[2][INET6_ADDRSTRLEN];
+           zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x, "
+                       "addr %s/%d broad %s", 
+                       __func__, ifm->ifam_index, 
+                       (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs,
+                       inet_ntop(AF_INET6,&addr->sin6.sin6_addr,
+                                 buf[0],sizeof(buf[0])),
+                       ip6_masklen(mask->sin6.sin6_addr),
+                       inet_ntop(AF_INET6,&brd->sin6.sin6_addr,
+                                 buf[1],sizeof(buf[1])));
+         }
+         break;
+#endif /* HAVE_IPV6 */
+        default:
+         zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x",
+                     __func__, ifm->ifam_index, 
+                     (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs);
+         break;
+        }
+    }
   
   /* Assert read up end point matches to end point */
   if (pnt != end)