diff options
author | 2004-12-20 08:30:40 +0000 | |
---|---|---|
committer | 2004-12-20 08:30:40 +0000 | |
commit | fec45d2e280655380bc96c874fe4d1fcfd4aaf82 (patch) | |
tree | 112726defcb4e9b26da3cb957d76517c6f5615d6 | |
parent | Enforce an ordering on ifnet such that CARP interfaces appear later in the (diff) | |
download | wireguard-openbsd-fec45d2e280655380bc96c874fe4d1fcfd4aaf82.tar.xz wireguard-openbsd-fec45d2e280655380bc96c874fe4d1fcfd4aaf82.zip |
Add support for displaying Shared Spanning Tree Protocol frames, a minor
variation on 802.1d/STP.
ok otto@ mcbride@
-rw-r--r-- | usr.sbin/tcpdump/print-llc.c | 12 | ||||
-rw-r--r-- | usr.sbin/tcpdump/print-stp.c | 32 |
2 files changed, 36 insertions, 8 deletions
diff --git a/usr.sbin/tcpdump/print-llc.c b/usr.sbin/tcpdump/print-llc.c index 004804dd4b0..addc261dfd9 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.13 2001/06/25 19:56:11 itojun Exp $ */ +/* $OpenBSD: print-llc.c,v 1.14 2004/12/20 08:30:40 pascoe Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997 @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-llc.c,v 1.13 2001/06/25 19:56:11 itojun Exp $"; + "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-llc.c,v 1.14 2004/12/20 08:30:40 pascoe Exp $"; #endif #include <sys/param.h> @@ -99,6 +99,14 @@ llc_print(const u_char *p, u_int length, u_int caplen, return (1); } + /* Shared Spanning Tree Protocol - SNAP & ether type 0x010b */ + if (llc.ssap == LLCSAP_SNAP && llc.dsap == LLCSAP_SNAP && + llc.llcui == LLC_UI && + llc.ethertype[0] == 0x01 && llc.ethertype[1] == 0x0b) { + stp_print(p, length); + return(1); + } + if (llc.ssap == LLCSAP_ISONS && llc.dsap == LLCSAP_ISONS && llc.llcui == LLC_UI) { isoclns_print(p + 3, length - 3, caplen - 3, esrc, edst); diff --git a/usr.sbin/tcpdump/print-stp.c b/usr.sbin/tcpdump/print-stp.c index 81068541249..7a321f67684 100644 --- a/usr.sbin/tcpdump/print-stp.c +++ b/usr.sbin/tcpdump/print-stp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-stp.c,v 1.3 2003/06/03 00:21:04 jason Exp $ */ +/* $OpenBSD: print-stp.c,v 1.4 2004/12/20 08:30:40 pascoe Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -68,7 +68,7 @@ struct rtentry; #define STP_FLAGS_TC 0x01 /* Topology change */ #define STP_FLAGS_TCA 0x80 /* Topology change ack */ -static void stp_print_cbpdu(const u_char *, u_int); +static void stp_print_cbpdu(const u_char *, u_int, int); static void stp_print_tbpdu(const u_char *, u_int); void @@ -77,14 +77,21 @@ stp_print(p, len) u_int len; { u_int16_t id; + int cisco_sstp = 0; if (len < 3) goto truncated; - if (p[0] != LLCSAP_8021D || p[1] != LLCSAP_8021D || p[2] != LLC_UI) { + if (p[0] == LLCSAP_8021D && p[1] == LLCSAP_8021D && p[2] == LLC_UI) + printf("802.1d"); + else if (p[0] == LLCSAP_SNAP && p[1] == LLCSAP_SNAP && p[2] == LLC_UI) { + cisco_sstp = 1; + printf("SSTP"); + p += 5; + len -= 5; + } else { printf("invalid protocol"); return; } - printf("802.1d"); p += 3; len -= 3; @@ -106,7 +113,7 @@ stp_print(p, len) goto truncated; switch (*p) { case STP_MSGTYPE_CBPDU: - stp_print_cbpdu(p, len); + stp_print_cbpdu(p, len, cisco_sstp); break; case STP_MSGTYPE_TBPDU: stp_print_tbpdu(p, len); @@ -123,9 +130,10 @@ truncated: } static void -stp_print_cbpdu(p, len) +stp_print_cbpdu(p, len, cisco_sstp) const u_char *p; u_int len; + int cisco_sstp; { u_int32_t cost; u_int16_t t; @@ -213,6 +221,18 @@ stp_print_cbpdu(p, len) p += 2; len -= 2; + if (cisco_sstp) { + if (len < 7) + goto truncated; + p += 1; + len -= 1; + if (EXTRACT_16BITS(p) == 0 && EXTRACT_16BITS(p + 2) == 0x02) { + printf(" pvid=%u", EXTRACT_16BITS(p + 4)); + p += 6; + len -= 6; + } + } + return; truncated: |