Increased capture length and adjusted 802.11 header length for radiotap
support.
This commit is contained in:
2
ether.h
2
ether.h
@@ -28,6 +28,6 @@ struct radiotap_header {
|
|||||||
u_int8_t it_pad;
|
u_int8_t it_pad;
|
||||||
u_int16_t it_len; /* entire length */
|
u_int16_t it_len; /* entire length */
|
||||||
u_int32_t it_present; /* fields present */
|
u_int32_t it_present; /* fields present */
|
||||||
};
|
} __attribute__((packed));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
9
iftop.c
9
iftop.c
@@ -86,9 +86,10 @@ static void finish(int sig) {
|
|||||||
* bytes of tcp/udp header */
|
* bytes of tcp/udp header */
|
||||||
/* Increase with a further 20 to account for IPv6 header length. */
|
/* Increase with a further 20 to account for IPv6 header length. */
|
||||||
/* IEEE 802.11 radiotap throws in a variable length header plus 8 (radiotap
|
/* IEEE 802.11 radiotap throws in a variable length header plus 8 (radiotap
|
||||||
* header header) plus 30 (802.11 MAC) plus 40 (IPv6) = 78, plus whatever's in
|
* header header) plus 34 (802.11 MAC) plus 40 (IPv6) = 78, plus whatever's in
|
||||||
* the radiotap payload */
|
* the radiotap payload */
|
||||||
#define CAPTURE_LENGTH 92
|
/*#define CAPTURE_LENGTH 92 */
|
||||||
|
#define CAPTURE_LENGTH 256
|
||||||
|
|
||||||
void init_history() {
|
void init_history() {
|
||||||
history = addr_hash_create();
|
history = addr_hash_create();
|
||||||
@@ -612,9 +613,9 @@ static void handle_eth_packet(unsigned char* args, const struct pcap_pkthdr* pkt
|
|||||||
*/
|
*/
|
||||||
static void handle_radiotap_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet)
|
static void handle_radiotap_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet)
|
||||||
{
|
{
|
||||||
/* 802.11 MAC header is = 30 bytes */
|
/* 802.11 MAC header is = 34 bytes (not sure if that's universally true) */
|
||||||
/* We could try harder to figure out hardware direction from the MAC header */
|
/* We could try harder to figure out hardware direction from the MAC header */
|
||||||
handle_ip_packet((struct ip*)(packet + ((struct radiotap_header *)packet)->it_len + 30),-1);
|
handle_ip_packet((struct ip*)(packet + ((struct radiotap_header *)packet)->it_len + 34),-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user