summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew J. Schorr <ajschorr@alumni.princeton.edu>2006-05-17 15:04:59 +0000
committerAndrew J. Schorr <ajschorr@alumni.princeton.edu>2006-05-17 15:04:59 +0000
commit55196042ac8def6f0057039017eb6a400d7f73fb (patch)
tree1953ee9c087c73040591d4e7b5290abdf08fcabf
parent6685978081f24f154f058bff48d54396c91271e1 (diff)
[debug] Improve zebra kernel socket debug message to include IP addresses.
2006-05-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * kernel_socket.c: (ifam_read_mesg) Improve debug message to show the IP address.
-rw-r--r--zebra/ChangeLog5
-rw-r--r--zebra/kernel_socket.c43
2 files changed, 45 insertions, 3 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog
index 07bf8bab..6235071f 100644
--- a/zebra/ChangeLog
+++ b/zebra/ChangeLog
@@ -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
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 9764cbb3..bd4d9c4b 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -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)