* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.146 2000-12-05 06:42:49 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.147 2000-12-18 05:41:58 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
extern void hex_print_with_offset(const u_char *, u_int, u_int);
extern void telnet_print(const u_char *, u_int);
extern void hex_print(const u_char *, u_int);
-extern int ether_encap_print(u_short, const u_char *, u_int, u_int);
+extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
- const u_char *);
+ const u_char *, u_short *);
extern void aarp_print(const u_char *, u_int);
extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.9 2000-09-29 04:58:35 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.10 2000-12-18 05:41:58 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
extracted_ethertype = 0;
if (ether_type < ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, NULL, NULL)==0) {
+ if (llc_print(p, length, caplen, NULL, NULL,
+ &extracted_ethertype)==0) {
/* ether_type not known, print raw packet */
if (!eflag)
cip_print((u_char *)bp, length);
if (!xflag && !qflag)
default_print(p, caplen);
}
- } else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
+ } else if (ether_encap_print(ether_type, p, length, caplen,
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
cip_print((u_char *)bp, length + RFC1483LLC_LEN);
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.59 2000-10-22 04:17:53 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.60 2000-12-18 05:41:59 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
length);
}
-static u_short extracted_ethertype;
-
/*
* This is the top level routine of the printer. 'p' is the points
* to the ether header of the packet, 'h->tv' is the timestamp,
u_int length = h->len;
struct ether_header *ep;
u_short ether_type;
+ u_short extracted_ethertype;
ts_print(&h->ts);
extracted_ethertype = 0;
if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, ESRC(ep), EDST(ep)) == 0) {
+ if (llc_print(p, length, caplen, ESRC(ep), EDST(ep),
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
ether_print((u_char *)ep, length);
if (!xflag && !qflag)
default_print(p, caplen);
}
- } else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
+ } else if (ether_encap_print(ether_type, p, length, caplen,
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
ether_print((u_char *)ep, length + ETHER_HDRLEN);
*
* Returns non-zero if it can do so, zero if the ethertype is unknown.
*
- * Stuffs the ether type into a global for the benefit of lower layers
- * that might want to know what it is.
+ * The Ethernet type code is passed through a pointer; if it was
+ * ETHERTYPE_8021Q, it gets updated to be the Ethernet type of
+ * the 802.1Q payload, for the benefit of lower layers that might
+ * want to know what it is.
*/
int
ether_encap_print(u_short ethertype, const u_char *p,
- u_int length, u_int caplen)
+ u_int length, u_int caplen, u_short *extracted_ethertype)
{
recurse:
- extracted_ethertype = ethertype;
+ *extracted_ethertype = ethertype;
switch (ethertype) {
if (ethertype > ETHERMTU)
goto recurse;
- extracted_ethertype = 0;
+ *extracted_ethertype = 0;
- if (llc_print(p, length, caplen, p - 18, p - 12) == 0) {
+ if (llc_print(p, length, caplen, p - 18, p - 12,
+ extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
ether_print(p - 18, length + 4);
- if (extracted_ethertype) {
+ if (*extracted_ethertype) {
printf("(LLC %s) ",
- etherproto_string(htons(extracted_ethertype)));
+ etherproto_string(htons(*extracted_ethertype)));
}
if (!xflag && !qflag)
default_print(p - 18, caplen + 4);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.47 2000-10-09 02:59:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.48 2000-12-18 05:41:59 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
extracted_ethertype = 0;
if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr))
- == 0) {
+ if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
+ &extracted_ethertype) == 0) {
/*
* Some kinds of LLC packet we cannot
* handle intelligently
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.8 2000-09-29 04:58:39 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.9 2000-12-18 05:41:59 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
{
const u_char *cp = bp + 4;
const struct gre *gre;
- u_short flags, proto;
+ u_short flags, proto, extracted_ethertype;
gre = (const struct gre *)bp;
cp += 4;
length -= cp - bp;
- if (ether_encap_print(proto, cp, length, length) == 0)
+ if (ether_encap_print(proto, cp, length, length,
+ &extracted_ethertype) == 0)
printf("gre-proto-0x%04X", proto);
return;
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.9 2000-09-29 04:58:43 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.10 2000-12-18 05:42:00 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
extracted_ethertype = 0;
if (ether_type < ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, ep->h_source,ep->h_dest)==0) {
+ if (llc_print(p, length, caplen, ep->h_source, ep->h_dest,
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
lane_print((u_char *)ep, length);
if (!xflag && !qflag)
default_print(p, caplen);
}
- } else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
+ } else if (ether_encap_print(ether_type, p, length, caplen,
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
lane_print((u_char *)ep, length + sizeof(*ep));
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.30 2000-12-05 06:42:48 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.31 2000-12-18 05:42:00 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
*/
int
llc_print(const u_char *p, u_int length, u_int caplen,
- const u_char *esrc, const u_char *edst)
+ const u_char *esrc, const u_char *edst, u_short *extracted_ethertype)
{
struct llc llc;
register u_short et;
/* This is an encapsulated Ethernet packet */
et = EXTRACT_16BITS(&llc.ethertype[0]);
- ret = ether_encap_print(et, p, length, caplen);
+ ret = ether_encap_print(et, p, length, caplen,
+ extracted_ethertype);
if (ret)
return (ret);
}
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.8 2000-10-06 04:23:14 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.9 2000-12-18 05:42:00 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
extracted_ethertype = 0;
if (FRAME_TYPE(trp) == TOKEN_FC_LLC) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr))
- == 0) {
+ if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
+ &extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
token_print(trp, length,