[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.
This commit is contained in:
Matteo Cypriani 2013-05-16 13:57:14 -04:00
parent b3f688b2cf
commit 75b6539757
1 changed files with 5 additions and 3 deletions

View File

@ -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 ;
}