diff options
-rw-r--r-- | capture.c | 36 | ||||
-rw-r--r-- | epan/packet.h | 14 | ||||
-rw-r--r-- | packet-chdlc.c | 13 | ||||
-rw-r--r-- | packet-chdlc.h | 7 | ||||
-rw-r--r-- | packet-clip.c | 6 | ||||
-rw-r--r-- | packet-clip.h | 7 | ||||
-rw-r--r-- | packet-eth.c | 14 | ||||
-rw-r--r-- | packet-eth.h | 4 | ||||
-rw-r--r-- | packet-ethertype.c | 17 | ||||
-rw-r--r-- | packet-fddi.c | 8 | ||||
-rw-r--r-- | packet-fddi.h | 7 | ||||
-rw-r--r-- | packet-ieee80211.c | 17 | ||||
-rw-r--r-- | packet-ieee80211.h | 4 | ||||
-rw-r--r-- | packet-ip.c | 6 | ||||
-rw-r--r-- | packet-ip.h | 5 | ||||
-rw-r--r-- | packet-ipx.c | 4 | ||||
-rw-r--r-- | packet-ipx.h | 7 | ||||
-rw-r--r-- | packet-isl.c | 13 | ||||
-rw-r--r-- | packet-isl.h | 7 | ||||
-rw-r--r-- | packet-llc.c | 21 | ||||
-rw-r--r-- | packet-llc.h | 7 | ||||
-rw-r--r-- | packet-netbios.c | 4 | ||||
-rw-r--r-- | packet-netbios.h | 4 | ||||
-rw-r--r-- | packet-null.c | 18 | ||||
-rw-r--r-- | packet-null.h | 7 | ||||
-rw-r--r-- | packet-ppp.c | 20 | ||||
-rw-r--r-- | packet-ppp.h | 7 | ||||
-rw-r--r-- | packet-raw.c | 24 | ||||
-rw-r--r-- | packet-raw.h | 7 | ||||
-rw-r--r-- | packet-sll.c | 16 | ||||
-rw-r--r-- | packet-sll.h | 7 | ||||
-rw-r--r-- | packet-tr.c | 8 | ||||
-rw-r--r-- | packet-tr.h | 7 | ||||
-rw-r--r-- | packet-vines.c | 5 | ||||
-rw-r--r-- | packet-vines.h | 7 | ||||
-rw-r--r-- | packet-vlan.c | 16 | ||||
-rw-r--r-- | packet-vlan.h | 7 |
37 files changed, 199 insertions, 189 deletions
@@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.157 2001/11/09 07:44:47 guy Exp $ + * $Id: capture.c,v 1.158 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1157,32 +1157,32 @@ pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr) /* update capture statistics */ switch (ld->linktype) { case WTAP_ENCAP_ETHERNET: - capture_eth(pd, 0, &ld->counts); + capture_eth(pd, 0, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_FDDI: case WTAP_ENCAP_FDDI_BITSWAPPED: - capture_fddi(pd, &ld->counts); + capture_fddi(pd, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_TOKEN_RING: - capture_tr(pd, 0, &ld->counts); + capture_tr(pd, 0, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_NULL: - capture_null(pd, &ld->counts); + capture_null(pd, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_PPP: - capture_ppp_hdlc(pd, 0, &ld->counts); + capture_ppp_hdlc(pd, 0, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_RAW_IP: - capture_raw(pd, &ld->counts); + capture_raw(pd, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_LINUX_ATM_CLIP: - capture_clip(pd, &ld->counts); + capture_clip(pd, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_IEEE_802_11: - capture_ieee80211(pd, 0, &ld->counts); + capture_ieee80211(pd, 0, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_CHDLC: - capture_chdlc(pd, 0, &ld->counts); + capture_chdlc(pd, 0, whdr.caplen, &ld->counts); break; /* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we should implement it at some @@ -1881,29 +1881,29 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr, switch (ld->linktype) { case WTAP_ENCAP_ETHERNET: - capture_eth(pd, 0, &ld->counts); + capture_eth(pd, 0, phdr->len, &ld->counts); break; case WTAP_ENCAP_FDDI: case WTAP_ENCAP_FDDI_BITSWAPPED: - capture_fddi(pd, &ld->counts); + capture_fddi(pd, phdr->len, &ld->counts); break; case WTAP_ENCAP_TOKEN_RING: - capture_tr(pd, 0, &ld->counts); + capture_tr(pd, 0, phdr->len, &ld->counts); break; case WTAP_ENCAP_NULL: - capture_null(pd, &ld->counts); + capture_null(pd, phdr->len, &ld->counts); break; case WTAP_ENCAP_PPP: - capture_ppp_hdlc(pd, 0, &ld->counts); + capture_ppp_hdlc(pd, 0, phdr->len, &ld->counts); break; case WTAP_ENCAP_RAW_IP: - capture_raw(pd, &ld->counts); + capture_raw(pd, phdr->len, &ld->counts); break; case WTAP_ENCAP_SLL: - capture_sll(pd, &ld->counts); + capture_sll(pd, phdr->len, &ld->counts); break; case WTAP_ENCAP_LINUX_ATM_CLIP: - capture_clip(pd, &ld->counts); + capture_clip(pd, phdr->len, &ld->counts); break; /* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we should implement it at some diff --git a/epan/packet.h b/epan/packet.h index 5c4efa6cae..52e5acfeba 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.38 2001/11/20 20:57:10 guy Exp $ + * $Id: packet.h,v 1.39 2001/11/20 21:59:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -43,11 +43,9 @@ #define array_length(x) (sizeof x / sizeof x[0]) /* Check whether the "len" bytes of data starting at "offset" is - * entirely inside the captured data for this packet. - * XXX - change it to take the captured length as an argument, and - * change the capture routines to take the captured length as an - * argument. */ -#define BYTES_ARE_IN_FRAME(offset, len) ((offset) + (len) <= pi.captured_len) + * entirely inside the captured data for this packet. */ +#define BYTES_ARE_IN_FRAME(offset, captured_len, len) \ + ((offset) + (len) <= (captured_len)) /* To pass one of two strings, singular or plural */ #define plurality(d,s,p) ((d) == 1 ? (s) : (p)) @@ -233,8 +231,8 @@ extern void dissect_data(tvbuff_t *tvb, int, packet_info *pinfo, /* These functions are in packet-ethertype.c */ -extern void capture_ethertype(guint16 etype, int offset, - const u_char *pd, packet_counts *ld); +extern void capture_ethertype(guint16 etype, const u_char *pd, int offset, + int len, packet_counts *ld); extern void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_ethertype, packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, int etype_id, int trailer_id); diff --git a/packet-chdlc.c b/packet-chdlc.c index 12d4ca84ae..5989980f90 100644 --- a/packet-chdlc.c +++ b/packet-chdlc.c @@ -1,10 +1,11 @@ /* packet-chdlc.c * Routines for Cisco HDLC packet disassembly * - * $Id: packet-chdlc.c,v 1.4 2001/06/18 02:17:45 guy Exp $ + * $Id: packet-chdlc.c,v 1.5 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -99,10 +100,14 @@ const value_string chdlc_vals[] = { }; void -capture_chdlc( const u_char *pd, int offset, packet_counts *ld ) { +capture_chdlc( const u_char *pd, int offset, int len, packet_counts *ld ) { + if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { + ld->other++; + return; + } switch (pntohs(&pd[offset + 2])) { case ETHERTYPE_IP: - capture_ip(pd, offset + 4, ld); + capture_ip(pd, offset + 4, len, ld); break; default: ld->other++; diff --git a/packet-chdlc.h b/packet-chdlc.h index 267dcab46d..166cde0843 100644 --- a/packet-chdlc.h +++ b/packet-chdlc.h @@ -1,11 +1,10 @@ /* packet-chdlc.h * - * $Id: packet-chdlc.h,v 1.2 2001/03/15 21:49:24 guy Exp $ + * $Id: packet-chdlc.h,v 1.3 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,7 +33,7 @@ #define CHDLC_ADDR_UNICAST 0x0f #define CHDLC_ADDR_MULTICAST 0x8f -void capture_chdlc(const u_char *, int, packet_counts *); +void capture_chdlc(const u_char *, int, int, packet_counts *); extern const value_string chdlc_vals[]; diff --git a/packet-clip.c b/packet-clip.c index 164d3df85d..24aba5e57d 100644 --- a/packet-clip.c +++ b/packet-clip.c @@ -1,7 +1,7 @@ /* packet-clip.c * Routines for clip packet disassembly * - * $Id: packet-clip.c,v 1.15 2001/09/23 23:10:30 guy Exp $ + * $Id: packet-clip.c,v 1.16 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -43,9 +43,9 @@ static gint ett_clip = -1; static dissector_handle_t ip_handle; void -capture_clip( const u_char *pd, packet_counts *ld ) { +capture_clip( const u_char *pd, int len, packet_counts *ld ) { - capture_ip(pd, 0, ld); + capture_ip(pd, 0, len, ld); } static void diff --git a/packet-clip.h b/packet-clip.h index 11190b0cc5..3887756cb1 100644 --- a/packet-clip.h +++ b/packet-clip.h @@ -1,11 +1,10 @@ /* packet-clip.h * - * $Id: packet-clip.h,v 1.4 2000/11/29 05:16:15 gram Exp $ + * $Id: packet-clip.h,v 1.5 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_CLIP_H__ #define __PACKET_CLIP_H__ -void capture_clip(const u_char *, packet_counts *); +void capture_clip(const u_char *, int, packet_counts *); #endif diff --git a/packet-eth.c b/packet-eth.c index 6aae7b3633..783cf746bd 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.66 2001/06/29 09:42:45 guy Exp $ + * $Id: packet-eth.c,v 1.67 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -71,12 +71,12 @@ static dissector_handle_t isl_handle; #define ETHERNET_SNAP 3 void -capture_eth(const u_char *pd, int offset, packet_counts *ld) +capture_eth(const u_char *pd, int offset, int len, packet_counts *ld) { guint16 etype, length; int ethhdr_type; /* the type of ethernet frame */ - if (!BYTES_ARE_IN_FRAME(offset, ETH_HEADER_SIZE)) { + if (!BYTES_ARE_IN_FRAME(offset, len, ETH_HEADER_SIZE)) { ld->other++; return; } @@ -106,7 +106,7 @@ capture_eth(const u_char *pd, int offset, packet_counts *ld) 01-00-0C-00-00 for ISL frames. */ if (pd[offset] == 0x01 && pd[offset+1] == 0x00 && pd[offset+2] == 0x0C && pd[offset+3] == 0x00 && pd[offset+4] == 0x00) { - capture_isl(pd, offset, ld); + capture_isl(pd, offset, len, ld); return; } @@ -127,13 +127,13 @@ capture_eth(const u_char *pd, int offset, packet_counts *ld) switch (ethhdr_type) { case ETHERNET_802_3: - capture_ipx(pd, offset, ld); + capture_ipx(pd, offset, len, ld); break; case ETHERNET_802_2: - capture_llc(pd, offset, ld); + capture_llc(pd, offset, len, ld); break; case ETHERNET_II: - capture_ethertype(etype, offset, pd, ld); + capture_ethertype(etype, pd, offset, len, ld); break; } } diff --git a/packet-eth.h b/packet-eth.h index 385d57e735..48ea485bef 100644 --- a/packet-eth.h +++ b/packet-eth.h @@ -1,6 +1,6 @@ /* packet-eth.h * - * $Id: packet-eth.h,v 1.5 2001/06/29 09:42:45 guy Exp $ + * $Id: packet-eth.h,v 1.6 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -24,6 +24,6 @@ #ifndef __PACKET_ETH_H__ #define __PACKET_ETH_H__ -void capture_eth(const u_char *, int, packet_counts *); +void capture_eth(const u_char *, int, int, packet_counts *); #endif diff --git a/packet-ethertype.c b/packet-ethertype.c index f4cd0f2ba4..42b5860ab0 100644 --- a/packet-ethertype.c +++ b/packet-ethertype.c @@ -1,14 +1,13 @@ /* ethertype.c * Routines for calling the right protocol for the ethertype. * - * $Id: packet-ethertype.c,v 1.20 2001/11/13 23:55:29 gram Exp $ + * $Id: packet-ethertype.c,v 1.21 2001/11/20 21:59:12 guy Exp $ * * Gilbert Ramirez <gram@alumni.rice.edu> * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -100,21 +99,21 @@ static void add_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype, guint length_before); void -capture_ethertype(guint16 etype, int offset, - const u_char *pd, packet_counts *ld) +capture_ethertype(guint16 etype, const u_char *pd, int offset, int len, + packet_counts *ld) { switch (etype) { case ETHERTYPE_IP: - capture_ip(pd, offset, ld); + capture_ip(pd, offset, len, ld); break; case ETHERTYPE_IPX: - capture_ipx(pd, offset, ld); + capture_ipx(pd, offset, len, ld); break; case ETHERTYPE_VLAN: - capture_vlan(pd, offset, ld); + capture_vlan(pd, offset, len, ld); break; case ETHERTYPE_VINES: - capture_vines(pd, offset, ld); + capture_vines(pd, offset, len, ld); break; default: ld->other++; diff --git a/packet-fddi.c b/packet-fddi.c index ee1adea540..ff55c4f6be 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel <deniel@worldnet.fr> * - * $Id: packet-fddi.c,v 1.51 2001/07/03 04:56:45 guy Exp $ + * $Id: packet-fddi.c,v 1.52 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -139,11 +139,11 @@ swap_mac_addr(u_char *swapped_addr, const u_char *orig_addr) void -capture_fddi(const u_char *pd, packet_counts *ld) +capture_fddi(const u_char *pd, int len, packet_counts *ld) { int offset = 0, fc; - if (!BYTES_ARE_IN_FRAME(0, FDDI_HEADER_SIZE)) { + if (!BYTES_ARE_IN_FRAME(0, len, FDDI_HEADER_SIZE)) { ld->other++; return; } @@ -171,7 +171,7 @@ capture_fddi(const u_char *pd, packet_counts *ld) case FDDI_FC_LLC_ASYNC + 13 : case FDDI_FC_LLC_ASYNC + 14 : case FDDI_FC_LLC_ASYNC + 15 : - capture_llc(pd, offset, ld); + capture_llc(pd, offset, len, ld); return; default : ld->other++; diff --git a/packet-fddi.h b/packet-fddi.h index d66dda91d0..fdeabd0df0 100644 --- a/packet-fddi.h +++ b/packet-fddi.h @@ -1,11 +1,10 @@ /* packet-fddi.h * - * $Id: packet-fddi.h,v 1.4 2000/11/29 05:16:15 gram Exp $ + * $Id: packet-fddi.h,v 1.5 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_FDDI_H__ #define __PACKET_FDDI_H__ -void capture_fddi(const u_char *, packet_counts *); +void capture_fddi(const u_char *, int, packet_counts *); #endif diff --git a/packet-ieee80211.c b/packet-ieee80211.c index 64b6d3b379..182ce7d49d 100644 --- a/packet-ieee80211.c +++ b/packet-ieee80211.c @@ -3,7 +3,7 @@ * Copyright 2000, Axis Communications AB * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com * - * $Id: packet-ieee80211.c,v 1.40 2001/09/25 02:21:15 guy Exp $ + * $Id: packet-ieee80211.c,v 1.41 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -381,10 +381,15 @@ find_header_length (guint16 fcf) /* This is the capture function used to update packet counts */ /* ************************************************************************* */ void -capture_ieee80211 (const u_char * pd, int offset, packet_counts * ld) +capture_ieee80211 (const u_char * pd, int offset, int len, packet_counts * ld) { guint16 fcf, hdr_length; + if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { + ld->other++; + return; + } + fcf = pletohs (&pd[0]); if (IS_WEP(COOK_FLAGS(fcf))) @@ -412,11 +417,15 @@ capture_ieee80211 (const u_char * pd, int offset, packet_counts * ld) Ethernet dissector, i.e. checking for 0xffff as the first four bytes of the payload and, if we find it, treating it as an IPX frame. */ + if (!BYTES_ARE_IN_FRAME(offset+hdr_length, len, 2)) { + ld->other++; + return; + } if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff) { - capture_ipx (pd, offset + hdr_length, ld); + capture_ipx (pd, offset + hdr_length, len, ld); } else { - capture_llc (pd, offset + hdr_length, ld); + capture_llc (pd, offset + hdr_length, len, ld); } break; diff --git a/packet-ieee80211.h b/packet-ieee80211.h index 689cb14a50..50ec5d01fa 100644 --- a/packet-ieee80211.h +++ b/packet-ieee80211.h @@ -4,7 +4,7 @@ * Copyright 2000, Axis Communications AB * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com * - * $Id: packet-ieee80211.h,v 1.3 2001/04/20 20:34:28 guy Exp $ + * $Id: packet-ieee80211.h,v 1.4 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -27,4 +27,4 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -void capture_ieee80211 (const u_char *, int, packet_counts *); +void capture_ieee80211 (const u_char *, int, int, packet_counts *); diff --git a/packet-ip.c b/packet-ip.c index 1c7c48db15..6f8ad5bbf3 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.144 2001/11/15 10:58:48 guy Exp $ + * $Id: packet-ip.c,v 1.145 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -333,8 +333,8 @@ ip_defragment_init(void) } void -capture_ip(const u_char *pd, int offset, packet_counts *ld) { - if (!BYTES_ARE_IN_FRAME(offset, IPH_MIN_LEN)) { +capture_ip(const u_char *pd, int offset, int len, packet_counts *ld) { + if (!BYTES_ARE_IN_FRAME(offset, len, IPH_MIN_LEN)) { ld->other++; return; } diff --git a/packet-ip.h b/packet-ip.h index 3436f95e17..aa9265bfd3 100644 --- a/packet-ip.h +++ b/packet-ip.h @@ -1,12 +1,11 @@ /* packet-ip.h * Definitions for IP packet disassembly structures and routines * - * $Id: packet-ip.h,v 1.19 2001/04/23 17:51:33 guy Exp $ + * $Id: packet-ip.h,v 1.20 2001/11/20 21:59:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -27,7 +26,7 @@ #ifndef __PACKET_IP_H__ #define __PACKET_IP_H__ -void capture_ip(const u_char *, int, packet_counts *); +void capture_ip(const u_char *, int, int, packet_counts *); typedef enum { NO_LENGTH, /* option has no data, hence no length */ diff --git a/packet-ipx.c b/packet-ipx.c index 0e2257d245..77f78f745b 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez <gram@alumni.rice.edu> * - * $Id: packet-ipx.c,v 1.91 2001/11/13 23:55:29 gram Exp $ + * $Id: packet-ipx.c,v 1.92 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -190,7 +190,7 @@ static const value_string ipxmsg_sigchar_vals[] = { }; void -capture_ipx(const u_char *pd, int offset, packet_counts *ld) +capture_ipx(const u_char *pd, int offset, int len, packet_counts *ld) { ld->ipx++; } diff --git a/packet-ipx.h b/packet-ipx.h index f49f096443..d4c911d080 100644 --- a/packet-ipx.h +++ b/packet-ipx.h @@ -2,12 +2,11 @@ * Routines for NetWare's IPX * Gilbert Ramirez <gram@alumni.rice.edu> * - * $Id: packet-ipx.h,v 1.14 2001/11/13 23:55:30 gram Exp $ + * $Id: packet-ipx.h,v 1.15 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@etheeal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -145,6 +144,6 @@ struct ipx_rip_packet #define IPX_SOCKET_UDP_TUNNEL 0x9092 /* RFC 1791 */ -void capture_ipx(const u_char *, int, packet_counts *); +void capture_ipx(const u_char *, int, int, packet_counts *); #endif diff --git a/packet-isl.c b/packet-isl.c index 768cce1897..2c6a4d3957 100644 --- a/packet-isl.c +++ b/packet-isl.c @@ -1,12 +1,11 @@ /* packet-isl.c * Routines for Cisco ISL Ethernet header disassembly * - * $Id: packet-isl.c,v 1.25 2001/06/18 02:17:48 guy Exp $ + * $Id: packet-isl.c,v 1.26 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -86,11 +85,11 @@ static dissector_handle_t eth_handle; static dissector_handle_t tr_handle; void -capture_isl(const u_char *pd, int offset, packet_counts *ld) +capture_isl(const u_char *pd, int offset, int len, packet_counts *ld) { guint8 type; - if (!BYTES_ARE_IN_FRAME(offset, ISL_HEADER_SIZE)) { + if (!BYTES_ARE_IN_FRAME(offset, len, ISL_HEADER_SIZE)) { ld->other++; return; } @@ -101,12 +100,12 @@ capture_isl(const u_char *pd, int offset, packet_counts *ld) case TYPE_ETHER: offset += 14+12; /* skip the header */ - capture_eth(pd, offset, ld); + capture_eth(pd, offset, len, ld); break; case TYPE_TR: offset += 14+17; /* skip the header */ - capture_tr(pd, offset, ld); + capture_tr(pd, offset, len, ld); break; default: diff --git a/packet-isl.h b/packet-isl.h index 102e15f616..98554572be 100644 --- a/packet-isl.h +++ b/packet-isl.h @@ -1,11 +1,10 @@ /* packet-isl.h * - * $Id: packet-isl.h,v 1.3 2000/12/28 09:49:09 guy Exp $ + * $Id: packet-isl.h,v 1.4 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_ISL_H__ #define __PACKET_ISL_H__ -void capture_isl(const u_char *, int, packet_counts *); +void capture_isl(const u_char *, int, int, packet_counts *); #endif diff --git a/packet-llc.c b/packet-llc.c index 065a274b47..33df7f5ad1 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,12 +2,11 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez <gram@alumni.rice.edu> * - * $Id: packet-llc.c,v 1.88 2001/11/13 23:55:30 gram Exp $ + * $Id: packet-llc.c,v 1.89 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -67,7 +66,7 @@ static dissector_handle_t eth_handle; static dissector_handle_t fddi_handle; static dissector_handle_t tr_handle; -typedef void (capture_func_t)(const u_char *, int, packet_counts *); +typedef void (capture_func_t)(const u_char *, int, int, packet_counts *); /* The SAP info is split into two tables, one value_string table and one * table of sap_info. This is so that the value_string can be used in the @@ -191,7 +190,7 @@ sap_capture_func(u_char sap) { } void -capture_llc(const u_char *pd, int offset, packet_counts *ld) { +capture_llc(const u_char *pd, int offset, int len, packet_counts *ld) { int is_snap; guint16 control; @@ -200,7 +199,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) { guint16 etype; capture_func_t *capture; - if (!BYTES_ARE_IN_FRAME(offset, 2)) { + if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { ld->other++; return; } @@ -218,7 +217,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) { llc_header_len += XDLC_CONTROL_LEN(control, TRUE); if (is_snap) llc_header_len += 5; /* 3 bytes of OUI, 2 bytes of protocol ID */ - if (!BYTES_ARE_IN_FRAME(offset, llc_header_len)) { + if (!BYTES_ARE_IN_FRAME(offset, len, llc_header_len)) { ld->other++; return; } @@ -239,12 +238,12 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) { AppleTalk data packets - but used OUI_ENCAP_ETHER and an Ethernet packet type for AARP packets. */ - capture_ethertype(etype, offset+8, pd, + capture_ethertype(etype, pd, offset+8, len, ld); break; case OUI_CISCO: - capture_ethertype(etype, - offset + 8, pd, ld); + capture_ethertype(etype, pd, offset + 8, len, + ld); break; default: ld->other++; @@ -260,7 +259,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) { offset += llc_header_len; if (capture) { - capture(pd, offset, ld); + capture(pd, offset, len, ld); } else { ld->other++; diff --git a/packet-llc.h b/packet-llc.h index a3ed1fd6c9..f6e9bcca22 100644 --- a/packet-llc.h +++ b/packet-llc.h @@ -1,11 +1,10 @@ /* packet-llc.h * - * $Id: packet-llc.h,v 1.5 2001/01/10 09:07:35 guy Exp $ + * $Id: packet-llc.h,v 1.6 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,7 +24,7 @@ #ifndef __PACKET_LLC_H__ #define __PACKET_LLC_H__ -void capture_llc(const u_char *, int, packet_counts *); +void capture_llc(const u_char *, int, int, packet_counts *); void dissect_snap(tvbuff_t *, int, packet_info *, proto_tree *, proto_tree *, int, int, int, int, int); diff --git a/packet-netbios.c b/packet-netbios.c index 31cd63e6e6..8046543324 100644 --- a/packet-netbios.c +++ b/packet-netbios.c @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.c,v 1.39 2001/09/29 20:32:29 guy Exp $ + * $Id: packet-netbios.c,v 1.40 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -218,7 +218,7 @@ static const true_false_string netb_version_str = { }; -void capture_netbios(const u_char *pd, int offset, packet_counts *ld) +void capture_netbios(const u_char *pd, int offset, int len, packet_counts *ld) { ld->netbios++; } diff --git a/packet-netbios.h b/packet-netbios.h index 3b49807184..0795c40208 100644 --- a/packet-netbios.h +++ b/packet-netbios.h @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.h,v 1.11 2001/09/29 00:57:36 guy Exp $ + * $Id: packet-netbios.h,v 1.12 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -32,7 +32,7 @@ /* Length of NetBIOS names */ #define NETBIOS_NAME_LEN 16 -void capture_netbios(const u_char *, int, packet_counts *); +void capture_netbios(const u_char *, int, int, packet_counts *); extern int process_netbios_name(const u_char *name_ptr, char *name_ret); extern int get_netbios_name(tvbuff_t *tvb, int offset, diff --git a/packet-null.c b/packet-null.c index d51d904c2d..067be26adf 100644 --- a/packet-null.c +++ b/packet-null.c @@ -1,7 +1,7 @@ /* packet-null.c * Routines for null packet disassembly * - * $Id: packet-null.c,v 1.46 2001/06/18 02:17:50 guy Exp $ + * $Id: packet-null.c,v 1.47 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -74,7 +74,7 @@ static const value_string family_vals[] = { static dissector_handle_t ppp_hdlc_handle; void -capture_null( const u_char *pd, packet_counts *ld ) +capture_null( const u_char *pd, int len, packet_counts *ld ) { guint32 null_header; @@ -163,15 +163,23 @@ capture_null( const u_char *pd, packet_counts *ld ) * given that the effect of inserting the two 0 bytes depends only * on the byte order of the machine reading the file.) */ + if (!BYTES_ARE_IN_FRAME(0, len, 2)) { + ld->other++; + return; + } if (pd[0] == 0xFF && pd[1] == 0x03) { /* * Hand it to PPP. */ - capture_ppp_hdlc(pd, 0, ld); + capture_ppp_hdlc(pd, 0, len, ld); } else { /* * Treat it as a normal DLT_NULL header. */ + if (!BYTES_ARE_IN_FRAME(0, len, (int)sizeof(null_header))) { + ld->other++; + return; + } memcpy((char *)&null_header, (char *)&pd[0], sizeof(null_header)); if ((null_header & 0xFFFF0000) != 0) { @@ -190,12 +198,12 @@ capture_null( const u_char *pd, packet_counts *ld ) * BSD derivatives have different values?). */ if (null_header > IEEE_802_3_MAX_LEN) - capture_ethertype(null_header, 4, pd, ld); + capture_ethertype(null_header, pd, 4, len, ld); else { switch (null_header) { case BSD_AF_INET: - capture_ip(pd, 4, ld); + capture_ip(pd, 4, len, ld); break; default: diff --git a/packet-null.h b/packet-null.h index 1962f560f5..a1b387e380 100644 --- a/packet-null.h +++ b/packet-null.h @@ -1,11 +1,10 @@ /* packet-null.h * - * $Id: packet-null.h,v 1.4 2000/11/29 05:16:15 gram Exp $ + * $Id: packet-null.h,v 1.5 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_NULL_H__ #define __PACKET_NULL_H__ -void capture_null(const u_char *, packet_counts *); +void capture_null(const u_char *, int, packet_counts *); #endif diff --git a/packet-ppp.c b/packet-ppp.c index df46dee135..2497c3986f 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.74 2001/11/04 04:50:12 guy Exp $ + * $Id: packet-ppp.c,v 1.75 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -952,20 +952,28 @@ fcs32(guint32 fcs, } void -capture_ppp_hdlc( const u_char *pd, int offset, packet_counts *ld ) { +capture_ppp_hdlc( const u_char *pd, int offset, int len, packet_counts *ld ) { + if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { + ld->other++; + return; + } if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST) { - capture_chdlc(pd, offset, ld); + capture_chdlc(pd, offset, len, ld); + return; + } + if (!BYTES_ARE_IN_FRAME(offset, len, 4)) { + ld->other++; return; } switch (pntohs(&pd[offset + 2])) { case PPP_IP: - capture_ip(pd, offset + 4, ld); + capture_ip(pd, offset + 4, len, ld); break; case PPP_IPX: - capture_ipx(pd, offset + 4, ld); + capture_ipx(pd, offset + 4, len, ld); break; case PPP_VINES: - capture_vines(pd, offset + 4, ld); + capture_vines(pd, offset + 4, len, ld); break; default: ld->other++; diff --git a/packet-ppp.h b/packet-ppp.h index 653a4465c0..49126f1704 100644 --- a/packet-ppp.h +++ b/packet-ppp.h @@ -1,11 +1,10 @@ /* packet-ppp.h * - * $Id: packet-ppp.h,v 1.7 2001/03/30 06:15:47 guy Exp $ + * $Id: packet-ppp.h,v 1.8 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_PPP_H__ #define __PACKET_PPP_H__ -void capture_ppp_hdlc(const u_char *, int, packet_counts *); +void capture_ppp_hdlc(const u_char *, int, int, packet_counts *); #endif diff --git a/packet-raw.c b/packet-raw.c index e14f583c75..85537b1c86 100644 --- a/packet-raw.c +++ b/packet-raw.c @@ -1,10 +1,10 @@ /* packet-raw.c * Routines for raw packet disassembly * - * $Id: packet-raw.c,v 1.26 2001/03/30 06:15:47 guy Exp $ + * $Id: packet-raw.c,v 1.27 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * * This file created and by Mike Hall <mlh@io.com> * Copyright 1998 @@ -47,7 +47,7 @@ static dissector_handle_t ip_handle; static dissector_handle_t ppp_hdlc_handle; void -capture_raw(const u_char *pd, packet_counts *ld) +capture_raw(const u_char *pd, int len, packet_counts *ld) { /* So far, the only time we get raw connection types are with Linux and * Irix PPP connections. We can't tell what type of data is coming down @@ -57,25 +57,25 @@ capture_raw(const u_char *pd, packet_counts *ld) /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header * sometimes. This check should be removed when 2.2 is out. */ - if (BYTES_ARE_IN_FRAME(0,2) && pd[0] == 0xff && pd[1] == 0x03) { - capture_ppp_hdlc(pd, 0, ld); + if (BYTES_ARE_IN_FRAME(0,len,2) && pd[0] == 0xff && pd[1] == 0x03) { + capture_ppp_hdlc(pd, 0, len, ld); } /* The Linux ISDN driver sends a fake MAC address before the PPP header * on its ippp interfaces... */ - else if (BYTES_ARE_IN_FRAME(0,8) && pd[6] == 0xff && pd[7] == 0x03) { - capture_ppp_hdlc(pd, 6, ld); + else if (BYTES_ARE_IN_FRAME(0,len,8) && pd[6] == 0xff && pd[7] == 0x03) { + capture_ppp_hdlc(pd, 6, len, ld); } /* ...except when it just puts out one byte before the PPP header... */ - else if (BYTES_ARE_IN_FRAME(0,3) && pd[1] == 0xff && pd[2] == 0x03) { - capture_ppp_hdlc(pd, 1, ld); + else if (BYTES_ARE_IN_FRAME(0,len,3) && pd[1] == 0xff && pd[2] == 0x03) { + capture_ppp_hdlc(pd, 1, len, ld); } /* ...and if the connection is currently down, it sends 10 bytes of zeroes * instead of a fake MAC address and PPP header. */ - else if (BYTES_ARE_IN_FRAME(0,10) && memcmp(pd, zeroes, 10) == 0) { - capture_ip(pd, 10, ld); + else if (BYTES_ARE_IN_FRAME(0,len,10) && memcmp(pd, zeroes, 10) == 0) { + capture_ip(pd, 10, len, ld); } else { - capture_ip(pd, 0, ld); + capture_ip(pd, 0, len, ld); } } diff --git a/packet-raw.h b/packet-raw.h index 3bfba25c4e..1fcfb878bf 100644 --- a/packet-raw.h +++ b/packet-raw.h @@ -1,11 +1,10 @@ /* packet-raw.h * - * $Id: packet-raw.h,v 1.4 2000/11/29 05:16:15 gram Exp $ + * $Id: packet-raw.h,v 1.5 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_RAW_H__ #define __PACKET_RAW_H__ -void capture_raw(const u_char *, packet_counts *); +void capture_raw(const u_char *, int, packet_counts *); #endif diff --git a/packet-sll.c b/packet-sll.c index 7a5706af8d..ea5533e0f5 100644 --- a/packet-sll.c +++ b/packet-sll.c @@ -1,12 +1,11 @@ /* packet-sll.c * Routines for disassembly of packets from Linux "cooked mode" captures * - * $Id: packet-sll.c,v 1.11 2001/07/16 05:16:58 guy Exp $ + * $Id: packet-sll.c,v 1.12 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,6 +34,7 @@ #include <string.h> #include <glib.h> #include "packet.h" +#include "packet-sll.h" #include "packet-ipx.h" #include "packet-llc.h" #include "resolv.h" @@ -92,11 +92,11 @@ static dissector_handle_t ipx_handle; static dissector_handle_t llc_handle; void -capture_sll(const u_char *pd, packet_counts *ld) +capture_sll(const u_char *pd, int len, packet_counts *ld) { guint16 protocol; - if (!BYTES_ARE_IN_FRAME(0, SLL_HEADER_SIZE)) { + if (!BYTES_ARE_IN_FRAME(0, len, SLL_HEADER_SIZE)) { ld->other++; return; } @@ -112,7 +112,7 @@ capture_sll(const u_char *pd, packet_counts *ld) /* * 802.2 LLC. */ - capture_llc(pd, SLL_HEADER_SIZE, ld); + capture_llc(pd, len, SLL_HEADER_SIZE, ld); break; case LINUX_SLL_P_802_3: @@ -120,7 +120,7 @@ capture_sll(const u_char *pd, packet_counts *ld) * Novell IPX inside 802.3 with no 802.2 LLC * header. */ - capture_ipx(pd, SLL_HEADER_SIZE, ld); + capture_ipx(pd, len, SLL_HEADER_SIZE, ld); break; default: @@ -128,7 +128,7 @@ capture_sll(const u_char *pd, packet_counts *ld) break; } } else - capture_ethertype(protocol, SLL_HEADER_SIZE, pd, ld); + capture_ethertype(protocol, pd, SLL_HEADER_SIZE, len, ld); } static void diff --git a/packet-sll.h b/packet-sll.h index 422eb5ea5a..c65fc34f12 100644 --- a/packet-sll.h +++ b/packet-sll.h @@ -1,11 +1,10 @@ /* packet-sll.h * - * $Id: packet-sll.h,v 1.1 2001/01/13 03:17:15 gram Exp $ + * $Id: packet-sll.h,v 1.2 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 2001 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_SLL_H__ #define __PACKET_SLL_H__ -void capture_sll(const u_char *, packet_counts *); +void capture_sll(const u_char *, int, packet_counts *); #endif diff --git a/packet-tr.c b/packet-tr.c index 5c65ea5446..5c2b250628 100644 --- a/packet-tr.c +++ b/packet-tr.c @@ -2,7 +2,7 @@ * Routines for Token-Ring packet disassembly * Gilbert Ramirez <gram@alumni.rice.edu> * - * $Id: packet-tr.c,v 1.64 2001/11/13 23:55:30 gram Exp $ + * $Id: packet-tr.c,v 1.65 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -179,7 +179,7 @@ static void add_ring_bridge_pairs(int rcf_len, tvbuff_t*, proto_tree *tree); void -capture_tr(const u_char *pd, int offset, packet_counts *ld) { +capture_tr(const u_char *pd, int offset, int len, packet_counts *ld) { int source_routed = 0; int frame_type; @@ -192,7 +192,7 @@ capture_tr(const u_char *pd, int offset, packet_counts *ld) { guint8 trn_fc; /* field control field */ const guint8 *trn_shost; /* source host */ - if (!BYTES_ARE_IN_FRAME(offset, TR_MIN_HEADER_LEN)) { + if (!BYTES_ARE_IN_FRAME(offset, len, TR_MIN_HEADER_LEN)) { ld->other++; return; } @@ -284,7 +284,7 @@ capture_tr(const u_char *pd, int offset, packet_counts *ld) { ld->other++; break; case 1: - capture_llc(pd, offset, ld); + capture_llc(pd, offset, len, ld); break; default: /* non-MAC, non-LLC, i.e., "Reserved" */ diff --git a/packet-tr.h b/packet-tr.h index d436d2a856..df543c40da 100644 --- a/packet-tr.h +++ b/packet-tr.h @@ -1,11 +1,10 @@ /* packet-tr.h * - * $Id: packet-tr.h,v 1.4 2001/01/21 20:16:01 guy Exp $ + * $Id: packet-tr.h,v 1.5 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_TR_H__ #define __PACKET_TR_H__ -void capture_tr(const u_char *, int, packet_counts *); +void capture_tr(const u_char *, int, int, packet_counts *); #endif diff --git a/packet-vines.c b/packet-vines.c index 8ab47fc37a..8680107718 100644 --- a/packet-vines.c +++ b/packet-vines.c @@ -1,7 +1,7 @@ /* packet-vines.c * Routines for Banyan VINES protocol packet disassembly * - * $Id: packet-vines.c,v 1.33 2001/06/18 02:17:53 guy Exp $ + * $Id: packet-vines.c,v 1.34 2001/11/20 21:59:13 guy Exp $ * * Don Lafontaine <lafont02@cn.ca> * @@ -9,7 +9,6 @@ * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * Joerg Mayer <jmayer@loplof.de> - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -72,7 +71,7 @@ static void dissect_vines_spp(tvbuff_t *, packet_info *, proto_tree *); static void dissect_vines(tvbuff_t *, packet_info *, proto_tree *); void -capture_vines(const u_char *pd, int offset, packet_counts *ld) +capture_vines(const u_char *pd, int offset, int len, packet_counts *ld) { ld->vines++; } diff --git a/packet-vines.h b/packet-vines.h index da1e9559ce..15db004576 100644 --- a/packet-vines.h +++ b/packet-vines.h @@ -1,15 +1,14 @@ /* packet-vines.h * Definitions for packet disassembly structures and routines * - * $Id: packet-vines.h,v 1.9 2001/04/17 00:46:03 guy Exp $ + * $Id: packet-vines.h,v 1.10 2001/11/20 21:59:13 guy Exp $ * * Don Lafontaine <lafont02@cn.ca> * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * Joerg Mayer <jmayer@loplof.de> - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -109,6 +108,6 @@ typedef struct _e_vsmb { guint32 vsmb_ttw; } e_vsmb; -void capture_vines(const u_char *, int, packet_counts *); +void capture_vines(const u_char *, int, int, packet_counts *); #endif /* packet-vines.h */ diff --git a/packet-vlan.c b/packet-vlan.c index 6205a0c184..10723fb9e7 100644 --- a/packet-vlan.c +++ b/packet-vlan.c @@ -1,12 +1,11 @@ /* packet-vlan.c * Routines for VLAN 802.1Q ethernet header disassembly * - * $Id: packet-vlan.c,v 1.34 2001/06/18 02:17:53 guy Exp $ + * $Id: packet-vlan.c,v 1.35 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -40,6 +39,7 @@ #include "packet-ieee8023.h" #include "packet-ipx.h" #include "packet-llc.h" +#include "packet-vlan.h" #include "etypes.h" static int proto_vlan = -1; @@ -53,21 +53,21 @@ static int hf_vlan_trailer = -1; static gint ett_vlan = -1; void -capture_vlan(const u_char *pd, int offset, packet_counts *ld ) { +capture_vlan(const u_char *pd, int offset, int len, packet_counts *ld ) { guint16 encap_proto; - if ( !BYTES_ARE_IN_FRAME(offset,5) ) { + if ( !BYTES_ARE_IN_FRAME(offset,len,5) ) { ld->other++; return; } encap_proto = pntohs( &pd[offset+2] ); if ( encap_proto <= IEEE_802_3_MAX_LEN) { if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) { - capture_ipx(pd,offset+4,ld); + capture_ipx(pd,offset+4,len,ld); } else { - capture_llc(pd,offset+4,ld); + capture_llc(pd,offset+4,len,ld); } } else { - capture_ethertype(encap_proto, offset+4, pd, ld); + capture_ethertype(encap_proto, pd, offset+4, len, ld); } } diff --git a/packet-vlan.h b/packet-vlan.h index 45ccb0e46e..c0295d1f93 100644 --- a/packet-vlan.h +++ b/packet-vlan.h @@ -1,11 +1,10 @@ /* packet-vlan.h * - * $Id: packet-vlan.h,v 1.3 2000/08/11 13:33:57 deniel Exp $ + * $Id: packet-vlan.h,v 1.4 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs - * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +24,6 @@ #ifndef __PACKET_VLAN_H__ #define __PACKET_VLAN_H__ -void capture_vlan(const u_char *, int, packet_counts *); +void capture_vlan(const u_char *, int, int, packet_counts *); #endif |