there seem to be some differences in print-llc.c with netbsd.
any idea why? for example, LLC_IS_POLL has a different vlaue
(0x0100 and 0x0001), but the code looks to be equivalent.
itojun
diff -c1 ./llc.h /home/itojun/NetBSD/src/usr.sbin/tcpdump/llc.h
*** ./llc.h Tue Jun 5 00:05:57 2001
--- /home/itojun/NetBSD/src/usr.sbin/tcpdump/llc.h Sat Oct 4 04:54:36 1997
***************
*** 1 ****
--- 1,3 ----
+ /* $NetBSD: llc.h,v 1.3 1997/10/03 19:54:36 christos Exp $ */
+
/*
***************
*** 20,22 ****
*
! * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.13 2001/06/04 05:47:13 guy Exp $
(LBL)
*/
--- 22,24 ----
*
! * @(#) Header: llc.h,v 1.6 97/06/13 02:06:07 leres Exp (LBL)
*/
***************
*** 34,48 ****
struct llc {
! u_int8_t dsap;
! u_int8_t ssap;
union {
! u_int8_t u_ctl;
! u_int16_t is_ctl;
struct {
! u_int8_t snap_ui;
! u_int8_t snap_pi[5];
} snap;
struct {
! u_int8_t snap_ui;
! u_int8_t snap_orgcode[3];
! u_int8_t snap_ethertype[2];
} snap_ether;
--- 36,50 ----
struct llc {
! u_char dsap;
! u_char ssap;
union {
! u_char u_ctl;
! u_short is_ctl;
struct {
! u_char snap_ui;
! u_char snap_pi[5];
} snap;
struct {
! u_char snap_ui;
! u_char snap_orgcode[3];
! u_char snap_ethertype[2];
} snap_ether;
***************
*** 53,56 ****
#define llcpi ctl.snap.snap_pi
! #define llc_orgcode ctl.snap_ether.snap_orgcode
! #define llc_ethertype ctl.snap_ether.snap_ethertype
#define llcis ctl.is_ctl
--- 55,58 ----
#define llcpi ctl.snap.snap_pi
! #define orgcode ctl.snap_ether.snap_orgcode
! #define ethertype ctl.snap_ether.snap_ethertype
#define llcis ctl.is_ctl
***************
*** 63,65 ****
#define LLC_U_POLL 0x10
! #define LLC_IS_POLL 0x0100
#define LLC_XID_FI 0x81
--- 65,67 ----
#define LLC_U_POLL 0x10
! #define LLC_IS_POLL 0x0001
#define LLC_XID_FI 0x81
***************
*** 76,84 ****
! #define LLC_S_CMD(is) (((is) >> 1) & 0x03)
! #define LLC_RR 0x0001
! #define LLC_RNR 0x0005
! #define LLC_REJ 0x0009
! #define LLC_IS_NR(is) (((is) >> 9) & 0x7f)
! #define LLC_I_NS(is) (((is) >> 1) & 0x7f)
--- 78,86 ----
! #define LLC_S_CMD(is) (((is) >> 10) & 0x03)
! #define LLC_RR 0x0100
! #define LLC_RNR 0x0500
! #define LLC_REJ 0x0900
! #define LLC_IS_NR(is) (((is) >> 1) & 0x7f)
! #define LLC_I_NS(is) (((is) >> 9) & 0x7f)
***************
*** 90,95 ****
#endif
! #ifndef LLCSAP_8021B_I
#define LLCSAP_8021B_I 0x02
#endif
! #ifndef LLCSAP_8021B_G
#define LLCSAP_8021B_G 0x03
--- 92,97 ----
#endif
! #ifndef LLCSAP_8021B
#define LLCSAP_8021B_I 0x02
#endif
! #ifndef LLCSAP_8021B
#define LLCSAP_8021B_G 0x03
***************
*** 117,124 ****
#endif
- #ifndef LLCSAP_IPX
- #define LLCSAP_IPX 0xe0
- #endif
- #ifndef LLCSAP_NETBEUI
- #define LLCSAP_NETBEUI 0xf0
- #endif
#ifndef LLCSAP_ISONS
--- 119,120 ----
***************
*** 126,132 ****
#endif
-
- #define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
- #define OUI_CISCO 0x00000c /* Cisco protocols */
- #define ETHERTYPE_CISCO_CDP 0x2000 /* Cisco Discovery Protocol */
- #define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
- #define OUI_APPLETALK 0x080007 /* Appletalk */
--- 122 ----
diff -c1 ./print-llc.c /home/itojun/NetBSD/src/usr.sbin/tcpdump/print-llc.c
*** ./print-llc.c Fri Jun 15 16:59:14 2001
--- /home/itojun/NetBSD/src/usr.sbin/tcpdump/print-llc.c Mon May 29 00:14:14
2000
***************
*** 1 ****
--- 1,3 ----
+ /* $NetBSD: print-llc.c,v 1.5 2000/05/28 01:25:20 matt Exp $ */
+
/*
***************
*** 24,32 ****
#ifndef lint
static const char rcsid[] =
! "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.39 2001/06/15 07:59:14
itojun Exp $";
#endif
-
- #ifdef HAVE_CONFIG_H
- #include "config.h"
#endif
--- 26,35 ----
+ #include <sys/cdefs.h>
#ifndef lint
+ #if 0
static const char rcsid[] =
! "@(#) Header: print-llc.c,v 1.24 97/01/01 20:56:48 leres Exp ";
! #else
! __RCSID("$NetBSD: print-llc.c,v 1.5 2000/05/28 01:25:20 matt Exp $");
#endif
#endif
***************
*** 48,50 ****
#include "llc.h"
- #include "ethertype.h"
--- 51,52 ----
***************
*** 67,69 ****
llc_print(const u_char *p, u_int length, u_int caplen,
! const u_char *esrc, const u_char *edst, u_short *extracted_ethertype)
{
--- 69,71 ----
llc_print(const u_char *p, u_int length, u_int caplen,
! const u_char *esrc, const u_char *edst)
{
***************
*** 71,73 ****
register u_short et;
- u_int16_t control;
register int ret;
--- 73,74 ----
***************
*** 84,94 ****
if (llc.ssap == LLCSAP_GLOBAL && llc.dsap == LLCSAP_GLOBAL) {
- /*
- * This is an Ethernet_802.3 IPX frame; it has an
- * 802.3 header (i.e., an Ethernet header where the
- * type/length field is <= ETHERMTU, i.e. it's a length
- * field, not a type field), but has no 802.2 header -
- * the IPX packet starts right after the Ethernet header,
- * with a signature of two bytes of 0xFF (which is
- * LLCSAP_GLOBAL).
- */
ipx_print(p, length);
--- 85,86 ----
***************
*** 96,163 ****
}
!
! if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
! stp_print(p, length);
! return (1);
! }
!
! if (llc.ssap == LLCSAP_IPX && llc.dsap == LLCSAP_IPX &&
! llc.llcui == LLC_UI) {
! /*
! * This is an Ethernet_802.2 IPX frame, with an 802.3
! * header and an 802.2 LLC header with the source and
! * destination SAPs being the IPX SAP.
! *
! * Skip DSAP, LSAP, and control field.
! */
! p += 3;
! length -= 3;
! caplen -= 3;
! ipx_print(p, length);
! return (1);
! }
!
! if (llc.ssap == LLCSAP_NETBEUI && llc.dsap == LLCSAP_NETBEUI
! && (!(llc.llcu & LLC_S_FMT) || llc.llcu == LLC_U_FMT)) {
! /*
! * we don't actually have a full netbeui parser yet, but the
! * smb parser can handle many smb-in-netbeui packets, which
! * is very useful, so we call that
! *
! * We don't call it for S frames, however, just I frames
! * (which are frames that don't have the low-order bit,
! * LLC_S_FMT, set in the first byte of the control field)
! * and UI frames (whose control field is just 3, LLC_U_FMT).
! */
!
! /*
! * Skip the DSAP and LSAP.
! */
! p += 2;
! length -= 2;
! caplen -= 2;
!
! /*
! * OK, what type of LLC frame is this? The length
! * of the control field depends on that - I frames
! * have a two-byte control field, and U frames have
! * a one-byte control field.
! */
! if (llc.llcu == LLC_U_FMT) {
! control = llc.llcu;
! p += 1;
! length -= 1;
! caplen -= 1;
! } else {
! /*
! * The control field in I and S frames is
! * little-endian.
! */
! control = EXTRACT_LE_16BITS(&llc.llcu);
! p += 2;
! length -= 2;
! caplen -= 2;
! }
! netbeui_print(control, p, length);
! return (1);
! }
if (llc.ssap == LLCSAP_ISONS && llc.dsap == LLCSAP_ISONS
--- 88,93 ----
}
! #ifdef notyet
! else if (p[0] == 0xf0 && p[1] == 0xf0)
! netbios_print(p, length);
! #endif
if (llc.ssap == LLCSAP_ISONS && llc.dsap == LLCSAP_ISONS
***************
*** 170,177 ****
&& llc.llcui == LLC_UI) {
- u_int32_t orgcode;
-
if (caplen < sizeof(llc)) {
! (void)printf("[|llc-snap]");
! default_print((u_char *)p, caplen);
! return (0);
}
--- 100,105 ----
&& llc.llcui == LLC_UI) {
if (caplen < sizeof(llc)) {
! (void)printf("[|llc-snap]");
! default_print((u_char *)p, caplen);
! return (0);
}
***************
*** 184,226 ****
! orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
! et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
! switch (orgcode) {
! case OUI_ENCAP_ETHER:
! case OUI_CISCO_90:
! /*
! * This is an encapsulated Ethernet packet,
! * or a packet bridged by some piece of
! * Cisco hardware; the protocol ID is
! * an Ethernet protocol type.
! */
! ret = ether_encap_print(et, p, length, caplen,
! extracted_ethertype);
! if (ret)
! return (ret);
! break;
!
! case OUI_APPLETALK:
! if (et == ETHERTYPE_ATALK) {
! /*
! * No, I have no idea why Apple used one
! * of their own OUIs, rather than
! * 0x000000, and an Ethernet packet
! * type, for Appletalk data packets,
! * but used 0x000000 and an Ethernet
! * packet type for AARP packets.
! */
! ret = ether_encap_print(et, p, length, caplen,
! extracted_ethertype);
! if (ret)
! return (ret);
! }
! break;
!
! case OUI_CISCO:
! if (et == ETHERTYPE_CISCO_CDP) {
! cdp_print(p, length, caplen, esrc, edst);
! return 1;
! }
! break;
! }
}
--- 112,118 ----
! /* This is an encapsulated Ethernet packet */
! et = EXTRACT_16BITS(&llc.ethertype[0]);
! ret = ether_encap_print(et, p, length, caplen);
! if (ret)
! return (ret);
}
***************
*** 249,262 ****
if ((llc.llcu & LLC_U_FMT) == LLC_U_FMT) {
- u_int16_t cmd;
const char *m;
char f;
!
! cmd = LLC_U_CMD(llc.llcu);
! m = tok2str(cmd2str, "%02x", cmd);
switch ((llc.ssap & LLC_GSAP) | (llc.llcu & LLC_U_POLL)) {
! case 0: f = 'C'; break;
! case LLC_GSAP: f = 'R'; break;
! case LLC_U_POLL: f = 'P'; break;
! case LLC_GSAP|LLC_U_POLL: f = 'F'; break;
! default: f = '?'; break;
}
--- 141,151 ----
if ((llc.llcu & LLC_U_FMT) == LLC_U_FMT) {
const char *m;
char f;
! m = tok2str(cmd2str, "%02x", LLC_U_CMD(llc.llcu));
switch ((llc.ssap & LLC_GSAP) | (llc.llcu & LLC_U_POLL)) {
! case 0: f = 'C'; break;
! case LLC_GSAP: f = 'R'; break;
! case LLC_U_POLL: f = 'P'; break;
! case LLC_GSAP|LLC_U_POLL: f = 'F'; break;
! default: f = '?'; break;
}
***************
*** 265,266 ****
--- 154,159 ----
+ if (caplen < 6) {
+ default_print_unaligned(p, caplen);
+ return (0);
+ }
p += 3;
***************
*** 270,277 ****
if ((llc.llcu & ~LLC_U_POLL) == LLC_XID) {
! if (*p == LLC_XID_FI) {
! printf(": %02x %02x", p[1], p[2]);
! p += 3;
! length -= 3;
! caplen -= 3;
! }
}
--- 163,170 ----
if ((llc.llcu & ~LLC_U_POLL) == LLC_XID) {
! if (*p == LLC_XID_FI) {
! printf(": %02x %02x", p[1], p[2]);
! p += 3;
! length -= 3;
! caplen -= 3;
! }
}
***************
*** 279,298 ****
char f;
!
! /*
! * The control field in I and S frames is little-endian.
! */
! control = EXTRACT_LE_16BITS(&llc.llcu);
! switch ((llc.ssap & LLC_GSAP) | (control & LLC_IS_POLL)) {
! case 0: f = 'C'; break;
! case LLC_GSAP: f = 'R'; break;
! case LLC_IS_POLL: f = 'P'; break;
! case LLC_GSAP|LLC_IS_POLL: f = 'F'; break;
! default: f = '?'; break;
}
! if ((control & LLC_S_FMT) == LLC_S_FMT) {
static char *llc_s[] = { "rr", "rej", "rnr", "03" };
(void)printf("%s (r=%d,%c)",
! llc_s[LLC_S_CMD(control)],
! LLC_IS_NR(control),
f);
--- 172,187 ----
char f;
! llc.llcis = ntohs(llc.llcis);
! switch ((llc.ssap & LLC_GSAP) | (llc.llcu & LLC_U_POLL)) {
! case 0: f = 'C'; break;
! case LLC_GSAP: f = 'R'; break;
! case LLC_U_POLL: f = 'P'; break;
! case LLC_GSAP|LLC_U_POLL: f = 'F'; break;
! default: f = '?'; break;
}
! if ((llc.llcu & LLC_S_FMT) == LLC_S_FMT) {
static char *llc_s[] = { "rr", "rej", "rnr", "03" };
(void)printf("%s (r=%d,%c)",
! llc_s[LLC_S_CMD(llc.llcis)],
! LLC_IS_NR(llc.llcis),
f);
***************
*** 300,303 ****
(void)printf("I (s=%d,r=%d,%c)",
! LLC_I_NS(control),
! LLC_IS_NR(control),
f);
--- 189,192 ----
(void)printf("I (s=%d,r=%d,%c)",
! LLC_I_NS(llc.llcis),
! LLC_IS_NR(llc.llcis),
f);
***************
*** 309,310 ****
--- 198,202 ----
(void)printf(" len=%d", length);
+ if (caplen > 0 && !xflag) {
+ default_print_unaligned(p, caplen);
+ }
return(1);
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe