diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-01-17 17:37:53 +0100 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-01-21 10:33:17 +0100 |
commit | 7053cae4fefa80af7544e49dd42230246a4f6304 (patch) | |
tree | 57e991b063164e2e0676c19b8981c479fff31b6c /zebra/kernel_socket.c | |
parent | zebra: fix debug prefix string size (diff) | |
download | frr-7053cae4fefa80af7544e49dd42230246a4f6304.tar.xz frr-7053cae4fefa80af7544e49dd42230246a4f6304.zip |
zebra: fix debug messages in ifam_read_mesg
Use the proper address family to convert binary address to string.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'zebra/kernel_socket.c')
-rw-r--r-- | zebra/kernel_socket.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 84b06e579..085133525 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -736,11 +736,14 @@ static void ifam_read_mesg(struct ifa_msghdr *ifm, union sockunion *addr, } if (IS_ZEBRA_DEBUG_KERNEL) { - int family = sockunion_family(addr); - switch (family) { + switch (sockunion_family(addr)) { case AF_INET: case AF_INET6: { char buf[4][INET6_ADDRSTRLEN]; + int masklen = + (sockunion_family(addr) == AF_INET) + ? ip_masklen(mask->sin.sin_addr) + : ip6_masklen(mask->sin6.sin6_addr); zlog_debug( "%s: ifindex %d, ifname %s, ifam_addrs 0x%x, " "ifam_flags 0x%x, addr %s/%d broad %s dst %s " @@ -748,15 +751,12 @@ static void ifam_read_mesg(struct ifa_msghdr *ifm, union sockunion *addr, __func__, ifm->ifam_index, (ifnlen ? ifname : "(nil)"), ifm->ifam_addrs, ifm->ifam_flags, - inet_ntop(family, &addr->sin.sin_addr, buf[0], - sizeof(buf[0])), - ip_masklen(mask->sin.sin_addr), - inet_ntop(family, &brd->sin.sin_addr, buf[1], - sizeof(buf[1])), - inet_ntop(family, &dst.sin.sin_addr, buf[2], - sizeof(buf[2])), - inet_ntop(family, &gateway.sin.sin_addr, buf[3], - sizeof(buf[3]))); + sockunion2str(addr, buf[0], sizeof(buf[0])), + masklen, + sockunion2str(brd, buf[1], sizeof(buf[1])), + sockunion2str(&dst, buf[2], sizeof(buf[2])), + sockunion2str(&gateway, buf[2], + sizeof(buf[2]))); } break; default: zlog_debug("%s: ifindex %d, ifname %s, ifam_addrs 0x%x", |