summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdw <>2011-10-04 18:30:59 +0000
committerpdw <>2011-10-04 18:30:59 +0000
commit093c15f72f46913f0a5e168dcd4690aeee635d01 (patch)
treef10656d94a00da8f546042604e1f3ac8072cf0fc
parentac177644c3dc3a08cc2e17e7555781f886be42f4 (diff)
downloadiftop-093c15f72f46913f0a5e168dcd4690aeee635d01.zip
Increased capture length and adjusted 802.11 header length for radiotap
support.
-rw-r--r--ether.h2
-rw-r--r--iftop.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/ether.h b/ether.h
index 26caf9b..cc0b3f2 100644
--- a/ether.h
+++ b/ether.h
@@ -28,6 +28,6 @@ struct radiotap_header {
u_int8_t it_pad;
u_int16_t it_len; /* entire length */
u_int32_t it_present; /* fields present */
-};
+} __attribute__((packed));
#endif
diff --git a/iftop.c b/iftop.c
index 0d46fc5..06778d6 100644
--- a/iftop.c
+++ b/iftop.c
@@ -86,9 +86,10 @@ static void finish(int sig) {
* bytes of tcp/udp header */
/* Increase with a further 20 to account for IPv6 header length. */
/* 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 */
-#define CAPTURE_LENGTH 92
+/*#define CAPTURE_LENGTH 92 */
+#define CAPTURE_LENGTH 256
void init_history() {
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)
{
- /* 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 */
- 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);
}