[Listener] Improve/fix radiotap fields definitions
This commit is contained in:
parent
0614b52219
commit
4a3e1e1091
|
@ -158,44 +158,41 @@ enum {MODE_ACTIVE = 'a', MODE_PASSIVE = 'p', MODE_MIXED = 'm'} ;
|
||||||
#define RTAP_L_HPAD 1 // Header pad
|
#define RTAP_L_HPAD 1 // Header pad
|
||||||
#define RTAP_L_HLENGTH 2 // Header length
|
#define RTAP_L_HLENGTH 2 // Header length
|
||||||
#define RTAP_L_PRESENTFLAGS 4 // Present flags
|
#define RTAP_L_PRESENTFLAGS 4 // Present flags
|
||||||
#define RTAP_L_MACTS 8 // MAC timestamp (Time Synchronization Function Timer)
|
#define RTAP_L_TSFT 8 // MAC timestamp (Time Synchronization Function Timer)
|
||||||
#define RTAP_L_FLAGS 1 // Flags
|
#define RTAP_L_FLAGS 1 // Flags
|
||||||
#define RTAP_L_RATE 1 // Data rate
|
#define RTAP_L_RATE 1 // Data rate
|
||||||
#define RTAP_L_CHANNEL 2 // Channel frequency
|
#define RTAP_L_CHANNEL 2 // Channel frequency
|
||||||
#define RTAP_L_CHANNELTYPE 2 // Channel type
|
#define RTAP_L_CHANNELFLAGS 2 // Channel flags (channel type)
|
||||||
#define RTAP_L_ANTENNASIGNALDBM 1 // SSI signal (dBm)
|
#define RTAP_L_FHSSHOPSET 1 // FHSS hop set
|
||||||
#define RTAP_L_ANTENNANOISEDBM 1 // SSI noise (dBm)
|
#define RTAP_L_FHSSHOPPATTERN 1 // FHSS hop pattern
|
||||||
|
#define RTAP_L_ANTENNASIGNAL 1 // Signal power at the antenna (dBm)
|
||||||
|
#define RTAP_L_ANTENNANOISE 1 // Noise power at the antenna (dBm)
|
||||||
|
#define RTAP_L_LOCKQUALITY 2 // Signal quality (quality of Barker code lock)
|
||||||
|
#define RTAP_L_TXATTENUATION 2 // Transmit power (distance from max power)
|
||||||
|
#define RTAP_L_DBTXATTENUATION 2 // Ditto (dB)
|
||||||
|
#define RTAP_L_DBMTXPOWER 1 // Absolute transmit power (dBm)
|
||||||
#define RTAP_L_ANTENNA 1 // Antenna number
|
#define RTAP_L_ANTENNA 1 // Antenna number
|
||||||
#define RTAP_L_FHSS 2 // Hop set and pattern for Frequency-Hopping Spread Spectrum
|
#define RTAP_L_DBANTENNASIGNAL 1 // Relative signal power at the antenna (dB)
|
||||||
#define RTAP_L_LOCKQUALITY 2 // Signal quality
|
#define RTAP_L_DBANTENNANOISE 1 // Relative noise power at the antenna (dB)
|
||||||
#define RTAP_L_TXATTENUATION 2 // Transmit power from max power
|
#define RTAP_L_RXFLAGS 2 // Properties of the received flags
|
||||||
#define RTAP_L_TXATTENUATIONDB 2 // Idem (dB)
|
|
||||||
#define RTAP_L_TXATTENUATIONDBM 1 // Idem (dBm)
|
|
||||||
#define RTAP_L_ANTENNASIGNALDB 1 // SSI signal (dB)
|
|
||||||
#define RTAP_L_ANTENNANOISEDB 1 // SSI noise (dB)
|
|
||||||
#define RTAP_L_FCS 4 // Frame Check Sequence
|
|
||||||
//#define RTAP_L_CHANNELP // Extended channel info (not implemented)
|
|
||||||
//#define RTAP_L_EXT // Present flags' extension (not emplemented)
|
|
||||||
|
|
||||||
|
|
||||||
/* Positions in 'Present flags' (and present fields 'check' array) */
|
/* Positions in 'Present flags' (and present fields 'check' array) */
|
||||||
#define RTAP_MACTS 0
|
#define RTAP_TSFT 0
|
||||||
#define RTAP_FLAGS 1
|
#define RTAP_FLAGS 1
|
||||||
#define RTAP_RATE 2
|
#define RTAP_RATE 2
|
||||||
#define RTAP_CHANNEL 3 // and RTAP_CHANNELTYPE
|
#define RTAP_CHANNEL 3 // Channel frequency and flags
|
||||||
#define RTAP_FHSS 4
|
#define RTAP_FHSS 4 // FHSS hop set and hop pattern
|
||||||
#define RTAP_ANTENNASIGNALDBM 5
|
#define RTAP_ANTENNASIGNAL 5
|
||||||
#define RTAP_ANTENNANOISEDBM 6
|
#define RTAP_ANTENNANOISE 6
|
||||||
#define RTAP_LOCKQUALITY 7
|
#define RTAP_LOCKQUALITY 7
|
||||||
#define RTAP_TXATTENUATION 8
|
#define RTAP_TXATTENUATION 8
|
||||||
#define RTAP_TXATTENUATIONDB 9
|
#define RTAP_DBTXATTENUATION 9
|
||||||
#define RTAP_TXATTENUATIONDBM 10
|
#define RTAP_DBMTXPOWER 10
|
||||||
#define RTAP_ANTENNA 11
|
#define RTAP_ANTENNA 11
|
||||||
#define RTAP_ANTENNASIGNALDB 12
|
#define RTAP_DBANTENNASIGNAL 12
|
||||||
#define RTAP_ANTENNANOISEDB 13
|
#define RTAP_DBANTENNANOISE 13
|
||||||
#define RTAP_FCS 14
|
#define RTAP_RXFLAGS 14
|
||||||
//#define RTAP_CHANNELP 18
|
|
||||||
//#define RTAP_EXT 31
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header,
|
||||||
mobile_ip_str,
|
mobile_ip_str,
|
||||||
request_time_str,
|
request_time_str,
|
||||||
capture_time_str,
|
capture_time_str,
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDBM] ? request.ss_dbm : 0,
|
rtap_fields[RTAP_ANTENNASIGNAL] ? request.ss_dbm : 0,
|
||||||
owl_ntohf(request.x_position),
|
owl_ntohf(request.x_position),
|
||||||
owl_ntohf(request.y_position),
|
owl_ntohf(request.y_position),
|
||||||
owl_ntohf(request.z_position),
|
owl_ntohf(request.z_position),
|
||||||
|
@ -1309,9 +1309,9 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
{
|
{
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case RTAP_MACTS:
|
case RTAP_TSFT:
|
||||||
rtap_fields[RTAP_MACTS] = true ;
|
rtap_fields[RTAP_TSFT] = true ;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_MACTS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_TSFT) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FLAGS:
|
case RTAP_FLAGS:
|
||||||
rtap_fields[RTAP_FLAGS] = true;
|
rtap_fields[RTAP_FLAGS] = true;
|
||||||
|
@ -1327,26 +1327,29 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
// aligned independently
|
// aligned independently
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_CHANNEL) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_CHANNEL) ;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_CHANNELTYPE) ;
|
RTAP_L_CHANNELFLAGS) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FHSS:
|
case RTAP_FHSS:
|
||||||
rtap_fields[RTAP_FHSS] = true;
|
rtap_fields[RTAP_FHSS] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FHSS) ;
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
|
RTAP_L_FHSSHOPSET) ;
|
||||||
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
|
RTAP_L_FHSSHOPPATTERN) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDBM:
|
case RTAP_ANTENNASIGNAL:
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDBM] = true ;
|
rtap_fields[RTAP_ANTENNASIGNAL] = true ;
|
||||||
rtap_position += nat_align(rtap_position,
|
rtap_position += nat_align(rtap_position,
|
||||||
RTAP_L_ANTENNASIGNALDBM) ;
|
RTAP_L_ANTENNASIGNAL) ;
|
||||||
memcpy(&request->ss_dbm,
|
memcpy(&request->ss_dbm,
|
||||||
&pkt_data[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
|
&pkt_data[rtap_position], RTAP_L_ANTENNASIGNAL) ;
|
||||||
if (VERBOSE_INFO)
|
if (VERBOSE_INFO)
|
||||||
printf("Antenna signal: %"PRId8" dBm\n", request->ss_dbm) ;
|
printf("Antenna signal: %"PRId8" dBm\n", request->ss_dbm) ;
|
||||||
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
|
rtap_position += RTAP_L_ANTENNASIGNAL ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDBM:
|
case RTAP_ANTENNANOISE:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDBM] = true;
|
rtap_fields[RTAP_ANTENNANOISE] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNANOISEDBM) ;
|
RTAP_L_ANTENNANOISE) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_LOCKQUALITY:
|
case RTAP_LOCKQUALITY:
|
||||||
rtap_fields[RTAP_LOCKQUALITY] = true;
|
rtap_fields[RTAP_LOCKQUALITY] = true;
|
||||||
|
@ -1358,33 +1361,33 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATION) ;
|
RTAP_L_TXATTENUATION) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDB:
|
case RTAP_DBTXATTENUATION:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDB] = true;
|
rtap_fields[RTAP_DBTXATTENUATION] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATIONDB) ;
|
RTAP_L_DBTXATTENUATION) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDBM:
|
case RTAP_DBMTXPOWER:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDBM] = true;
|
rtap_fields[RTAP_DBMTXPOWER] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATIONDBM) ;
|
RTAP_L_DBMTXPOWER) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNA:
|
case RTAP_ANTENNA:
|
||||||
rtap_fields[RTAP_ANTENNA] = true;
|
rtap_fields[RTAP_ANTENNA] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_ANTENNA) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_ANTENNA) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDB:
|
case RTAP_DBANTENNASIGNAL:
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDB] = true;
|
rtap_fields[RTAP_DBANTENNASIGNAL] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNASIGNALDB) ;
|
RTAP_L_DBANTENNASIGNAL) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDB:
|
case RTAP_DBANTENNANOISE:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDB] = true;
|
rtap_fields[RTAP_DBANTENNANOISE] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNANOISEDB) ;
|
RTAP_L_DBANTENNANOISE) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FCS:
|
case RTAP_RXFLAGS:
|
||||||
rtap_fields[RTAP_FCS] = true;
|
rtap_fields[RTAP_RXFLAGS] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FCS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_RXFLAGS) ;
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Warning! Radiotap field not handled: bit"
|
fprintf(stderr, "Warning! Radiotap field not handled: bit"
|
||||||
|
|
Loading…
Reference in New Issue