vlan updates for etype<maxlen and capture counters

svn path=/trunk/; revision=1219
This commit is contained in:
Nathan Neulinger 1999-12-05 20:05:45 +00:00
parent 3eb2e8576e
commit 455835d35a
3 changed files with 25 additions and 10 deletions

View File

@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
* $Id: ethertype.c,v 1.20 1999/12/05 02:32:41 guy Exp $
* $Id: ethertype.c,v 1.21 1999/12/05 20:05:44 nneul Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@ -66,6 +66,9 @@ capture_ethertype(guint16 etype, int offset,
case ETHERTYPE_IPX:
capture_ipx(pd, offset, cap_len, ld);
break;
case ETHERTYPE_VLAN:
capture_vlan(pd, offset, cap_len, ld);
break;
default:
ld->other++;
break;

View File

@ -1,7 +1,7 @@
/* packet-vlan.c
* Routines for VLAN 802.1Q ethernet header disassembly
*
* $Id: packet-vlan.c,v 1.5 1999/12/03 21:28:11 nneul Exp $
* $Id: packet-vlan.c,v 1.6 1999/12/05 20:05:44 nneul Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -47,6 +47,24 @@ static int hf_vlan_cfi = -1;
static gint ett_vlan = -1;
void
capture_vlan(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld ) {
guint32 encap_proto;
if ( !BYTES_ARE_IN_FRAME(offset,5) ) {
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,cap_len,ld);
} else {
capture_llc(pd,offset+4,cap_len,ld);
}
} else {
capture_ethertype(encap_proto, offset+4, pd, cap_len, ld);
}
}
void
dissect_vlan(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree *ti, *vlan_tree = NULL;
@ -77,18 +95,11 @@ dissect_vlan(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
if ( encap_proto <= IEEE_802_3_MAX_LEN) {
#if 0
if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) {
dissect_ipx(pd,offset+4,fd,tree);
/* should capture_ipx */
} else {
dissect_llc(pd,offset+4,fd,tree);
/* should capture_llc */
}
#else
dissect_data(pd,offset+4,fd,tree);
/* I don't know what to here, so am just doing as data for now */
#endif
} else {
ethertype(encap_proto, offset+4, pd, fd, tree, vlan_tree, hf_vlan_etype);
}

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.155 1999/12/03 21:50:31 nneul Exp $
* $Id: packet.h,v 1.156 1999/12/05 20:05:45 nneul Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -288,6 +288,7 @@ void capture_netbios(const u_char *, int, guint32, packet_counts *);
void capture_llc(const u_char *, int, guint32, packet_counts *);
void capture_ip(const u_char *, int, guint32, packet_counts *);
void capture_ipx(const u_char *, int, guint32, packet_counts *);
void capture_vlan(const u_char *, int, guint32, packet_counts *);
/*
* Routines in packet-*.c