summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-04-05 00:57:59 +0000
committerdlg <dlg@openbsd.org>2019-04-05 00:57:59 +0000
commit8e229e7c02590fb11f9029f58e671a8928e22bf5 (patch)
tree4db9bd215a9303064d9fdca9af290bd49b74ffa4
parentMake tpm(4) attach to MSFT0101 chips. (diff)
downloadwireguard-openbsd-8e229e7c02590fb11f9029f58e671a8928e22bf5.tar.xz
wireguard-openbsd-8e229e7c02590fb11f9029f58e671a8928e22bf5.zip
support printing cdp over gre and ppp
ok deraadt@ mpi@ sthen@
-rw-r--r--usr.sbin/tcpdump/interface.h7
-rw-r--r--usr.sbin/tcpdump/print-cdp.c9
-rw-r--r--usr.sbin/tcpdump/print-gre.c5
-rw-r--r--usr.sbin/tcpdump/print-llc.c4
-rw-r--r--usr.sbin/tcpdump/print-ppp.c5
5 files changed, 16 insertions, 14 deletions
diff --git a/usr.sbin/tcpdump/interface.h b/usr.sbin/tcpdump/interface.h
index 83bd145e8e2..70fe8e2bf33 100644
--- a/usr.sbin/tcpdump/interface.h
+++ b/usr.sbin/tcpdump/interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.h,v 1.79 2018/10/22 16:12:45 kn Exp $ */
+/* $OpenBSD: interface.h,v 1.80 2019/04/05 00:57:59 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.79 2018/10/22 16:12:45 kn Exp $ (LBL)
+ * @(#) $Id: interface.h,v 1.80 2019/04/05 00:57:59 dlg Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -270,8 +270,7 @@ extern void ike_print(const u_char *, u_int);
extern void udpencap_print(const u_char *, u_int, const u_char *);
extern void ah_print(const u_char *, u_int, const u_char *);
extern void esp_print(const u_char *, u_int, const u_char *);
-extern void cdp_print(const u_char *, u_int, u_int, const u_char *,
- const u_char *);
+extern void cdp_print(const u_char *, u_int, u_int, int);
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);
diff --git a/usr.sbin/tcpdump/print-cdp.c b/usr.sbin/tcpdump/print-cdp.c
index 4a2586e50e7..61a9ac96e5a 100644
--- a/usr.sbin/tcpdump/print-cdp.c
+++ b/usr.sbin/tcpdump/print-cdp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-cdp.c,v 1.6 2016/03/29 04:07:50 canacar Exp $ */
+/* $OpenBSD: print-cdp.c,v 1.7 2019/04/05 00:57:59 dlg Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
@@ -46,20 +46,17 @@ void cdp_print_prefixes(const u_char * p, int l);
* Returns non-zero IFF it succeeds in printing the header
*/
void
-cdp_print(const u_char *p, u_int length, u_int caplen,
- const u_char *esrc, const u_char *edst)
+cdp_print(const u_char *p, u_int length, u_int caplen, int i)
{
- int i;
int type, len;
/* Cisco Discovery Protocol */
- if (caplen < 12) {
+ if (caplen < i + 4) {
printf("[|cdp]");
return;
}
- i=8; /* CDP data starts at offset 8 */
printf("CDP v%d, ttl=%ds", p[i], p[i+1]);
i+=4; /* skip version, TTL and chksum */
diff --git a/usr.sbin/tcpdump/print-gre.c b/usr.sbin/tcpdump/print-gre.c
index c4e3be0d49f..a1ed13d3392 100644
--- a/usr.sbin/tcpdump/print-gre.c
+++ b/usr.sbin/tcpdump/print-gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-gre.c,v 1.23 2019/04/02 11:10:54 dlg Exp $ */
+/* $OpenBSD: print-gre.c,v 1.24 2019/04/05 00:57:59 dlg Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -269,6 +269,9 @@ gre_print_0(const u_char *p, u_int length)
case ERSPAN_II:
gre_print_erspan2(p, length);
break;
+ case 0x2000:
+ cdp_print(p, length, l, 0);
+ break;
default:
printf("unknown-proto-%04x", proto);
}
diff --git a/usr.sbin/tcpdump/print-llc.c b/usr.sbin/tcpdump/print-llc.c
index f613f582f51..a18e859930e 100644
--- a/usr.sbin/tcpdump/print-llc.c
+++ b/usr.sbin/tcpdump/print-llc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-llc.c,v 1.20 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-llc.c,v 1.21 2019/04/05 00:57:59 dlg Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
@@ -100,7 +100,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
/* Cisco Discovery Protocol - SNAP & ether type 0x2000 */
if (llc.ethertype[0] == 0x20 && llc.ethertype[1] == 0x00) {
- cdp_print(p, length, caplen, esrc, edst);
+ cdp_print(p, length, caplen, 8);
return (1);
}
/* Shared Spanning Tree Protocol - SNAP & ether type 0x010b */
diff --git a/usr.sbin/tcpdump/print-ppp.c b/usr.sbin/tcpdump/print-ppp.c
index ec13ff496eb..78edc46a073 100644
--- a/usr.sbin/tcpdump/print-ppp.c
+++ b/usr.sbin/tcpdump/print-ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ppp.c,v 1.32 2018/02/06 03:41:58 dlg Exp $ */
+/* $OpenBSD: print-ppp.c,v 1.33 2019/04/05 00:57:59 dlg Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -390,6 +390,9 @@ ppp_print(const u_char *p, u_int length)
case PPP_IPV6CP:
handle_ipv6cp(p, l);
break;
+ case PPP_CDP:
+ cdp_print(p, length, l, 0);
+ break;
}
}