From e0ea2a3c4b69d0d91840ac0ffe3825ad367e0cb1 Mon Sep 17 00:00:00 2001 From: Vasily Evseenko Date: Wed, 25 Jan 2017 10:14:55 +0300 Subject: [PATCH] Increase pcap buffer Don't set rfmon twice --- rx.cpp | 4 ++-- tx.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rx.cpp b/rx.cpp index 0b129a3..401c1ca 100644 --- a/rx.cpp +++ b/rx.cpp @@ -55,9 +55,9 @@ Receiver::Receiver(const char *wlan, int radio_port, Aggregator *agg) : agg(agg) throw runtime_error(string_format("Unable to open interface %s in pcap: %s\n", wlan, errbuf)); } - if (pcap_set_snaplen(ppcap, 2048) !=0) throw runtime_error("set_snaplen failed"); + if (pcap_set_snaplen(ppcap, 4096) !=0) throw runtime_error("set_snaplen failed"); if (pcap_set_promisc(ppcap, 1) != 0) throw runtime_error("set_promisc failed"); - if (pcap_set_rfmon(ppcap, 1) !=0) throw runtime_error("set_rfmon failed"); + //if (pcap_set_rfmon(ppcap, 1) !=0) throw runtime_error("set_rfmon failed"); if (pcap_set_timeout(ppcap, -1) !=0) throw runtime_error("set_timeout failed"); //if (pcap_set_buffer_size(ppcap, 2048) !=0) throw runtime_error("set_buffer_size failed"); if (pcap_activate(ppcap) !=0) throw runtime_error(string_format("pcap_activate failed: %s", pcap_geterr(ppcap))); diff --git a/tx.cpp b/tx.cpp index 43b167a..768dde9 100644 --- a/tx.cpp +++ b/tx.cpp @@ -49,9 +49,9 @@ Transmitter::Transmitter(const char *wlan, int k, int n, uint8_t radio_rate, uin if (ppcap == NULL){ throw runtime_error(string_format("Unable to open interface %s in pcap: %s", wlan, errbuf)); } - if (pcap_set_snaplen(ppcap, 1024) !=0) throw runtime_error("set_snaplen failed"); + if (pcap_set_snaplen(ppcap, 4096) !=0) throw runtime_error("set_snaplen failed"); if (pcap_set_promisc(ppcap, 1) != 0) throw runtime_error("set_promisc failed"); - if (pcap_set_rfmon(ppcap, 1) !=0) throw runtime_error("set_rfmon failed"); + //if (pcap_set_rfmon(ppcap, 1) !=0) throw runtime_error("set_rfmon failed"); if (pcap_set_timeout(ppcap, -1) !=0) throw runtime_error("set_timeout failed"); //if (pcap_set_buffer_size(ppcap, 2048) !=0) throw runtime_error("set_buffer_size failed"); if (pcap_activate(ppcap) !=0) throw runtime_error(string_format("pcap_activate failed: %s", pcap_geterr(ppcap)));