diff options
author | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:20:42 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:20:42 +0000 |
commit | 3b74598d7ea581deadb14ec8ba1c77c14295a7c8 (patch) | |
tree | 01f74f6819cfb28636e2f6d04efefacdfecafc5c /contrib/tcpdump/print-llc.c | |
parent | 68a3d30d4eef678528761ead6b0743885324cdd0 (diff) | |
download | FreeBSD-src-3b74598d7ea581deadb14ec8ba1c77c14295a7c8.zip FreeBSD-src-3b74598d7ea581deadb14ec8ba1c77c14295a7c8.tar.gz |
Import of tcpdump v3.9.8
Diffstat (limited to 'contrib/tcpdump/print-llc.c')
-rw-r--r-- | contrib/tcpdump/print-llc.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c index dcb740b..bc41985 100644 --- a/contrib/tcpdump/print-llc.c +++ b/contrib/tcpdump/print-llc.c @@ -24,7 +24,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.5 2005/09/29 07:40:13 hannes Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.10 2007/02/08 07:07:51 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -80,20 +80,31 @@ static const struct tok llc_flag_values[] = { { LLC_GSAP, "Response" }, { LLC_U_POLL, "Poll" }, { LLC_GSAP|LLC_U_POLL, "Final" }, + { LLC_IS_POLL, "Poll" }, { LLC_GSAP|LLC_IS_POLL, "Final" }, { 0, NULL } }; + +static const struct tok llc_ig_flag_values[] = { + { 0, "Individual" }, + { LLC_IG, "Group" }, + { 0, NULL } +}; + + static const struct tok llc_supervisory_values[] = { { 0, "Receiver Ready" }, - { 1, "Reject" }, - { 2, "Receiver not Ready" }, + { 1, "Receiver not Ready" }, + { 2, "Reject" }, { 0, NULL } }; static const struct tok cisco_values[] = { { PID_CISCO_CDP, "CDP" }, + { PID_CISCO_VTP, "VTP" }, + { PID_CISCO_DTP, "DTP" }, { 0, NULL } }; @@ -112,6 +123,10 @@ static const struct tok bridged_values[] = { { 0, NULL }, }; +static const struct tok null_values[] = { + { 0, NULL } +}; + struct oui_tok { u_int32_t oui; const struct tok *tok; @@ -138,6 +153,8 @@ llc_print(const u_char *p, u_int length, u_int caplen, int is_u; register int ret; + *extracted_ethertype = 0; + if (caplen < 3) { (void)printf("[|llc]"); default_print((u_char *)p, caplen); @@ -145,9 +162,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, } dsap_field = *p; - dsap = dsap_field & ~LLC_IG; ssap_field = *(p + 1); - ssap = ssap_field & ~LLC_GSAP; /* * OK, what type of LLC frame is this? The length @@ -179,7 +194,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, is_u = 0; } - if (ssap == LLCSAP_GLOBAL && dsap == LLCSAP_GLOBAL) { + if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) { /* * This is an Ethernet_802.3 IPX frame; it has an * 802.3 header (i.e., an Ethernet header where the @@ -202,17 +217,22 @@ llc_print(const u_char *p, u_int length, u_int caplen, return (1); } + dsap = dsap_field & ~LLC_IG; + ssap = ssap_field & ~LLC_GSAP; + if (eflag) { - printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x)", + printf("LLC, dsap %s (0x%02x) %s, ssap %s (0x%02x) %s", tok2str(llc_values, "Unknown", dsap), dsap, + tok2str(llc_ig_flag_values, "Unknown", dsap_field & LLC_IG), tok2str(llc_values, "Unknown", ssap), - ssap); + ssap, + tok2str(llc_flag_values, "Unknown", ssap_field & LLC_GSAP)); if (is_u) { - printf(", cmd 0x%02x: ", control); + printf(", ctrl 0x%02x: ", control); } else { - printf(", cmd 0x%04x: ", control); + printf(", ctrl 0x%04x: ", control); } } @@ -319,7 +339,7 @@ llc_print(const u_char *p, u_int length, u_int caplen, if (is_u) { printf("Unnumbered, %s, Flags [%s], length %u", tok2str(llc_cmd_values, "%02x", LLC_U_CMD(control)), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_U_POLL)), + tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_U_POLL)), length); p += 3; @@ -335,18 +355,17 @@ llc_print(const u_char *p, u_int length, u_int caplen, } } } else { - if ((control & LLC_S_FMT) == LLC_S_FMT) { (void)printf("Supervisory, %s, rcv seq %u, Flags [%s], length %u", tok2str(llc_supervisory_values,"?",LLC_S_CMD(control)), LLC_IS_NR(control), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)), + tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)), length); } else { (void)printf("Information, send seq %u, rcv seq %u, Flags [%s], length %u", LLC_I_NS(control), LLC_IS_NR(control), - bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)), + tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)), length); } p += 4; @@ -369,7 +388,7 @@ snap_print(const u_char *p, u_int length, u_int caplen, et = EXTRACT_16BITS(p + 3); if (eflag) { - const struct tok *tok = NULL; + const struct tok *tok = null_values; const struct oui_tok *otp; for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) { |