diff options
| author | 2009-11-27 13:14:35 +0000 | |
|---|---|---|
| committer | 2009-11-27 13:14:35 +0000 | |
| commit | c474f8d1547637ca5a576cb70e94ec4c58c5692a (patch) | |
| tree | 23a702d5b0959ef12743a84ce5cf86c50703719c /usr.sbin/tcpdump/print-ip6.c | |
| parent | ci->ci_curprocpaddr must initialized before cpu1 get into cpu_switchto(). (diff) | |
| download | wireguard-openbsd-c474f8d1547637ca5a576cb70e94ec4c58c5692a.tar.xz wireguard-openbsd-c474f8d1547637ca5a576cb70e94ec4c58c5692a.zip | |
Print outer ipv6 addresses for encapsulated packets only if tcpdump
is run with -v. This behavior is analog to ipv4.
ok mpf@ todd@
Diffstat (limited to 'usr.sbin/tcpdump/print-ip6.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-ip6.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c index 629c5e12fee..b9ef3df0e34 100644 --- a/usr.sbin/tcpdump/print-ip6.c +++ b/usr.sbin/tcpdump/print-ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip6.c,v 1.11 2009/10/27 23:59:55 deraadt Exp $ */ +/* $OpenBSD: print-ip6.c,v 1.12 2009/11/27 13:14:35 bluhm Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 @@ -114,9 +114,13 @@ ip6_print(register const u_char *bp, register int length) while (cp + hlen < snapend) { cp += hlen; +#ifndef IPPROTO_IPV4 +#define IPPROTO_IPV4 4 +#endif if (cp == (u_char *)(ip6 + 1) && nh != IPPROTO_TCP && nh != IPPROTO_UDP && - nh != IPPROTO_ESP && nh != IPPROTO_AH) { + nh != IPPROTO_ESP && nh != IPPROTO_AH && + (vflag || (nh != IPPROTO_IPV4 && nh != IPPROTO_IPV6))) { (void)printf("%s > %s: ", ip6addr_string(&ip6->ip6_src), ip6addr_string(&ip6->ip6_dst)); } @@ -171,12 +175,13 @@ ip6_print(register const u_char *bp, register int length) goto end; case IPPROTO_IPV6: ip6_print(cp, len); + if (! vflag) + printf(" (encap)"); goto end; -#ifndef IPPROTO_IPV4 -#define IPPROTO_IPV4 4 -#endif case IPPROTO_IPV4: ip_print(cp, len); + if (! vflag) + printf(" (encap)"); goto end; case IPPROTO_NONE: (void)printf("no next header"); |
