[Listener] Accept all data frames

The listener dropped all non-bare Data frames. It now accepts Data
subtypes as well (QoS Data, etc.).
This commit is contained in:
Matteo Cypriani 2011-01-24 12:02:35 +01:00
parent b07a4eb63d
commit 87e364a633
2 changed files with 19 additions and 5 deletions

View File

@ -481,7 +481,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
couple_message couple ; // Message to send to the aggregator
ssize_t nsent ; // sendto return value
BOOL check[15] ; // Present flags
unsigned char raw_packet_type ; // Received packet type (beacon, data…)
unsigned char raw_packet_fc1 ; // First byte of the received frame's FC
unsigned char raw_packet_fc2 ; // Second byte of the received frame's FC
unsigned char raw_packet_flags ; // IEEE 802.11 header flags
unsigned short llc_packet_type = 0 ;
// Pointer to the (possible) IP header of the packet:
@ -504,10 +505,20 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
rtap_bytes = le16toh(rtap_bytes) ;
// After the rtap header, there is the 802.11 header; the first byte
// is the packet type (beacon or not):
raw_packet_type = data[rtap_bytes] ;
// is the first byte of the Frame Control (FC) field, which contains
// the type of the packet (Management, Control or Data) and its subtype
// (QoS, etc.):
raw_packet_fc1 = data[rtap_bytes] ;
if (! IS_DATA_FRAME(raw_packet_fc1)) // Data packet?
goto not_explicit_packet ;
if (raw_packet_type != RAW_PACKET_TYPE_DATA) // Data packet?
// The second byte of the FC field contains the frame flags. The two
// first bits indicate the frame source and destination types: the
// first bit is "To DS" and the second is "From DS", so if the second
// bit is 0 the frame comes from a STA. That's what we want for an
// explicit packet:
raw_packet_fc2 = data[rtap_bytes+1] ;
if (! IS_FRAME_FROM_STA(raw_packet_fc2))
goto not_explicit_packet ;
// Get the packet type (protocol, 2 bytes) from the LLC header:

View File

@ -127,7 +127,10 @@ typedef struct _autocalibration_order
/* Types des paquets capturés (en-tête IEEE 802.11) */
#define RAW_PACKET_TYPE_BEACON 0x80
#define RAW_PACKET_TYPE_DATA 0x08
#define FRAME_TYPE_DATA_MASK 0x08
#define IS_DATA_FRAME(FCS1) (((FCS1) & FRAME_TYPE_DATA_MASK) == FRAME_TYPE_DATA_MASK)
#define FRAME_FROM_STA_MASK 0x02
#define IS_FRAME_FROM_STA(FCS2) (((FCS2) & FRAME_FROM_STA_MASK) != FRAME_FROM_STA_MASK)
/* Position des champs fixes de l'en-tête radiotap (octets) */