From 4d30021006bba04c4f890952273adeb792d08126 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 23 Mar 2012 22:23:42 +0100 Subject: [PATCH] protos: minor fixes in ipv6_routing and hex printing Minor fixes by Markus Amend. Signed-off-by: Daniel Borkmann --- src/proto_hex.h | 8 ++++---- src/proto_ipv6_routing.h | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/proto_hex.h b/src/proto_hex.h index 5a911981..d20dc26e 100644 --- a/src/proto_hex.h +++ b/src/proto_hex.h @@ -20,17 +20,17 @@ static inline void hex(uint8_t *packet, size_t len) size_t plen = len; uint8_t *buff; + if (len == 0) + return; + tprintf(" [ Payload hex "); for (buff = packet; len-- > 0; buff++) tprintf("%.2x ", *buff); tprintf("]\n"); - tprintf(" [ Payload chr "); for (buff = packet; plen-- > 0; buff++) tprintf("%c ", isprint(*buff) ? *buff : '.'); - tprintf("]\n"); - - tprintf("\n"); + tprintf("]\n\n"); } static inline void hex_none_newline(uint8_t *packet, size_t len) diff --git a/src/proto_ipv6_routing.h b/src/proto_ipv6_routing.h index ba9ea1a7..5855ce32 100644 --- a/src/proto_ipv6_routing.h +++ b/src/proto_ipv6_routing.h @@ -42,10 +42,9 @@ static inline void routing(uint8_t *packet, size_t len) char address[INET6_ADDRSTRLEN]; for (int i = sizeof(struct routinghdr) + 4; i < hdr_ext_len; i += 16) { - tprintf("\n\tAdress: "); - inet_ntop(AF_INET6, &packet[i], address, - sizeof(address)); - tprintf("%s %u", address ,INET6_ADDRSTRLEN); + tprintf("\n\t Address: "); + tprintf("%s", inet_ntop(AF_INET6, &packet[i], + address, sizeof(address))); } } else { tprintf("Appendix 0x"); -- 2.11.4.GIT