aboutsummaryrefslogtreecommitdiffstats
path: root/packet-raw.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-11-20 21:59:18 +0000
committerGuy Harris <guy@alum.mit.edu>2001-11-20 21:59:18 +0000
commite8d4f4f0ac7481c316b3e25a41b1cc747440220e (patch)
treeae3c72a5204d6498a7f2957738be88615f89a115 /packet-raw.c
parent62490b8fdb16d066581c40405cb0d8484248fb09 (diff)
Make the capture routines take an additional argument giving the amount
of packet data captured. Make the "BYTES_ARE_IN_FRAME()" macro take a "captured length of the packet" argument. Add some length checks to capture routines. svn path=/trunk/; revision=4235
Diffstat (limited to 'packet-raw.c')
-rw-r--r--packet-raw.c24
1 files changed, 12 insertions, 12 deletions
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);
}
}