summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-02-10 10:00:33 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-02-10 10:00:33 +0000
commit4c321531fe36a0389009bf48b54d40c73c307194 (patch)
tree8c13903abda21942950ad4ee6faedcea96ebdf28
parentaaf781209863845de427d806b9debacc6d519a85 (diff)
print etherip on ipv6.
-rw-r--r--usr.sbin/tcpdump/interface.h6
-rw-r--r--usr.sbin/tcpdump/print-etherip.c10
-rw-r--r--usr.sbin/tcpdump/print-ip.c8
-rw-r--r--usr.sbin/tcpdump/print-ip6.c9
4 files changed, 20 insertions, 13 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index d5a718a847d..ae1801b6f16 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.h,v 1.71 2018/02/06 03:07:51 dlg Exp $ */
+/* $OpenBSD: interface.h,v 1.72 2018/02/10 10:00:32 dlg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -20,7 +20,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Id: interface.h,v 1.71 2018/02/06 03:07:51 dlg Exp $ (LBL)
+ * @(#) $Id: interface.h,v 1.72 2018/02/10 10:00:32 dlg Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -271,7 +271,7 @@ extern void stp_print(const u_char *, u_int);
extern void radius_print(const u_char *, u_int);
extern void lwres_print(const u_char *, u_int);
extern void ether_print(const u_char *, u_int);
-extern void etherip_print(const u_char *, u_int, u_int, const u_char *);
+extern void etherip_print(const u_char *, u_int, u_int);
extern void ipcomp_print(const u_char *, u_int, const u_char *);
extern void mpls_print(const u_char *, u_int);
extern void lldp_print(const u_char *, u_int);
diff --git a/usr.sbin/tcpdump/print-etherip.c b/usr.sbin/tcpdump/print-etherip.c
index 6c690df8e15..65752526b9f 100644
--- a/usr.sbin/tcpdump/print-etherip.c
+++ b/usr.sbin/tcpdump/print-etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-etherip.c,v 1.9 2017/03/08 10:05:30 jca Exp $ */
+/* $OpenBSD: print-etherip.c,v 1.10 2018/02/10 10:00:32 dlg Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -56,22 +56,20 @@
extern u_short extracted_ethertype;
void
-etherip_print(const u_char *bp, u_int caplen, u_int len, const u_char *bp2)
+etherip_print(const u_char *bp, u_int caplen, u_int len)
{
- const struct ip *ip = (const struct ip *)bp2;
struct ether_header *eh;
const u_char *pbuf = bp;
u_int plen = caplen, hlen;
u_int16_t etype;
+ printf("etherip ");
+
if (plen < sizeof(struct etherip_header)) {
printf("[|etherip]");
return;
}
- printf("etherip %s > %s ver ", ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
-
switch (*pbuf >> 4) {
case 2:
hlen = 1;
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c
index b433cbb7678..475b79ee906 100644
--- a/usr.sbin/tcpdump/print-ip.c
+++ b/usr.sbin/tcpdump/print-ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ip.c,v 1.48 2018/02/06 03:07:51 dlg Exp $ */
+/* $OpenBSD: print-ip.c,v 1.49 2018/02/10 10:00:32 dlg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -537,8 +537,10 @@ ip_print(const u_char *bp, u_int length)
#define IPPROTO_ETHERIP 97
#endif
case IPPROTO_ETHERIP:
- etherip_print(cp, snapend - cp, len,
- (const u_char *)ip);
+ (void)printf("%s > %s: ",
+ ipaddr_string(&ip->ip_src),
+ ipaddr_string(&ip->ip_dst));
+ etherip_print(cp, snapend - cp, len);
break;
#ifndef IPPROTO_IPCOMP
diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c
index 42efd0d7a0b..86b5989de1f 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.25 2018/02/06 03:07:51 dlg Exp $ */
+/* $OpenBSD: print-ip6.c,v 1.26 2018/02/10 10:00:32 dlg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
@@ -196,6 +196,13 @@ ip6_print(const u_char *bp, u_int length)
(void)printf("no next header");
goto end;
+#ifndef IPPROTO_ETHERIP
+#define IPPROTO_ETHERIP 97
+#endif
+ case IPPROTO_ETHERIP:
+ etherip_print(cp, snapend - cp, len);
+ goto end;
+
#ifndef IPPROTO_CARP
#define IPPROTO_CARP 112
#endif