From eead1e4a62b3951e1e4bd48159b73355a7836806 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Thu, 22 Sep 2011 21:27:07 +0000 Subject: Let tcpdump use the same format for printing IPv6 fragments as for IPv4. Now it is id:len@off+more for both. ok jsing --- usr.sbin/tcpdump/print-frag6.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/usr.sbin/tcpdump/print-frag6.c b/usr.sbin/tcpdump/print-frag6.c index 816a31d7213..5df71e3f402 100644 --- a/usr.sbin/tcpdump/print-frag6.c +++ b/usr.sbin/tcpdump/print-frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-frag6.c,v 1.4 2009/10/27 23:59:55 deraadt Exp $ */ +/* $OpenBSD: print-frag6.c,v 1.5 2011/09/22 21:27:06 bluhm Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994 @@ -64,21 +64,14 @@ frag6_print(register const u_char *bp, register const u_char *bp2) /* 'ep' points to the end of avaible data. */ ep = snapend; - TCHECK(dp->ip6f_offlg); + TCHECK(dp->ip6f_ident); - if (vflag) { - TCHECK(dp->ip6f_ident); - printf("frag (0x%08x:%d|%ld)", - ntohl(dp->ip6f_ident), - ntohs(dp->ip6f_offlg & IP6F_OFF_MASK), - sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - - (long)(bp - bp2) - sizeof(struct ip6_frag)); - } else { - printf("frag (%d|%ld)", - ntohs(dp->ip6f_offlg & IP6F_OFF_MASK), - sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - - (long)(bp - bp2) - sizeof(struct ip6_frag)); - } + printf("frag (0x%08x:%ld@%d%s)", + ntohl(dp->ip6f_ident), + sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - + (long)(bp - bp2) - sizeof(struct ip6_frag), + ntohs(dp->ip6f_offlg & IP6F_OFF_MASK), + (dp->ip6f_offlg & IP6F_MORE_FRAG) ? "+" : ""); /* it is meaningless to decode non-first fragment */ if (ntohs(dp->ip6f_offlg & IP6F_OFF_MASK) != 0) -- cgit v1.2.3