From 75b65397571ce755316747f21bc5b4f82fe3d625 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Thu, 16 May 2013 13:57:14 -0400 Subject: [PATCH] [Listener] Warn if rtap SS field is absent Display a warning if the radiotap antenna signal is absent and the signal strength could not be extracted. Change the SS value to 127 dBm (the maximum and improbable value) in this case. --- owlps-listener/owlps-listenerd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index 8876d71..6311f7d 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -977,7 +977,6 @@ void read_packet(const struct pcap_pkthdr *pkt_header, owl_captured_request request ; // Message to send to the aggregator uint16_t rtap_bytes ; // Radiotap header size uint_fast16_t offset ; // Offset to read the packet - bool antenna_signal_present ; // Is the antenna signal field present? uint8_t raw_packet_fc1 ; // First byte of the received frame's FC uint8_t raw_packet_fc2 ; // Second byte of the received frame's FC // Size of the IEEE 802.11 header: @@ -1168,7 +1167,9 @@ void read_packet(const struct pcap_pkthdr *pkt_header, return ; /* Radiotap header handling */ - antenna_signal_present = extract_radiotap_ss(pkt_data, &request) ; + if (! extract_radiotap_ss(pkt_data, &request)) + fprintf(stderr, "Warning! The antenna signal field is absent from" + " the radiotap header!\n") ; /* Display the packet details */ if (VERBOSE_DISPLAY_CAPTURED) @@ -1215,7 +1216,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header, mobile_ip_str, request_time_str, capture_time_str, - antenna_signal_present ? request.ss_dbm : 0, + request.ss_dbm, owl_ntohf(request.x_position), owl_ntohf(request.y_position), owl_ntohf(request.z_position), @@ -1337,6 +1338,7 @@ bool extract_radiotap_ss(const u_char *pkt_data, } // Antenna signal not extracted + request->ss_dbm = 127 ; // maximum, improbable value return false ; }