diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-08-13 08:53:51 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-08-13 08:53:51 +0000 |
commit | db31ba13c8b9f82c1b96b5444fe3b7e8ff109ce1 (patch) | |
tree | d8a337dbbb3884c4f4fd5a6ff845b78d4f16652b /packet-raw.c | |
parent | 1c910d808a2e2b56cd3bfd53b76dc69b3a69bcd3 (diff) |
Cope with some of the *other* oddities that Linux ISDN appears to stick
at the beginning of packets.
svn path=/trunk/; revision=2266
Diffstat (limited to 'packet-raw.c')
-rw-r--r-- | packet-raw.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/packet-raw.c b/packet-raw.c index 4e92c43890..55fbdfc968 100644 --- a/packet-raw.c +++ b/packet-raw.c @@ -1,7 +1,7 @@ /* packet-raw.c * Routines for raw packet disassembly * - * $Id: packet-raw.c,v 1.17 2000/05/25 07:42:25 gram Exp $ + * $Id: packet-raw.c,v 1.18 2000/08/13 08:53:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -40,9 +40,11 @@ static gint ett_raw = -1; -void -capture_raw( const u_char *pd, packet_counts *ld ) { +static const char zeroes[10]; +void +capture_raw(const u_char *pd, 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 * the line, so our safest bet is IP. - GCC @@ -55,10 +57,19 @@ capture_raw( const u_char *pd, packet_counts *ld ) { capture_ppp(pd, 0, ld); } /* The Linux ISDN driver sends a fake MAC address before the PPP header - * on its ippp interfaces. */ + * on its ippp interfaces... */ else if (BYTES_ARE_IN_FRAME(0,8) && pd[6] == 0xff && pd[7] == 0x03) { capture_ppp(pd, 6, 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(pd, 1, 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 { capture_ip(pd, 0, ld); } @@ -105,12 +116,25 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; } /* The Linux ISDN driver sends a fake MAC address before the PPP header - * on its ippp interfaces. */ + * on its ippp interfaces... */ else if (tvb_get_ntohs(tvb, 6) == 0xff03) { next_tvb = tvb_new_subset(tvb, 6, -1, -1); dissect_ppp(next_tvb, pinfo, tree); return; } + /* ...except when it just puts out one byte before the PPP header... */ + else if (tvb_get_ntohs(tvb, 1) == 0xff03) { + next_tvb = tvb_new_subset(tvb, 1, -1, -1); + dissect_ppp(next_tvb, pinfo, tree); + return; + } + /* ...and if the connection is currently down, it sends 10 bytes of zeroes + * instead of a fake MAC address and PPP header. */ + else if (memcmp(tvb_get_ptr(tvb, 0, 10), zeroes, 10) == 0) { + tvb_compat(tvb, &next_pd, &next_offset); + dissect_ip(next_pd, next_offset + 10, pinfo->fd, tree); + return; + } else { tvb_compat(tvb, &next_pd, &next_offset); dissect_ip(next_pd, next_offset, pinfo->fd, tree); |