timestamp field
Since there was no objection, reposting as final - will adopt in a week from now unless there are any final objections.
The definition can be found at
http://www.radiotap.org/suggested-fields/timestamp
johannes
epan/dissectors/packet-ieee80211-radiotap-defs.h +17 -2
@@ -207,6 +207,7 @@ enum ieee80211_radiotap_type {IEEE80211_RADIOTAP_MCS =19 ,IEEE80211_RADIOTAP_AMPDU_STATUS =20 ,IEEE80211_RADIOTAP_VHT =21 , +IEEE80211_RADIOTAP_TIMESTAMP =22 ,/* valid in every it_present bitmap, even vendor namespaces */ IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -215,8 +216,8 @@ enum ieee80211_radiotap_type { };/* not (yet) defined Radiotap present flag */ -/* Bit 22 to 28 are not defined (in binary : 0001 1111 1100 0000 0000 0000 0000 0000 */ -#define IEEE80211_RADIOTAP_NOTDEFINED 0x1FC00000 +/* Bit 23 to 28 are not defined (in binary : 0001 1111 1000 0000 0000 0000 0000 0000 */ +#define IEEE80211_RADIOTAP_NOTDEFINED 0x1F800000/* Channel flags. */ /* 0x00000001 through 0x00000008 undefined (reserved?) */
@@ -362,5 +363,19 @@ enum ieee80211_radiotap_type {#define IEEE80211_RADIOTAP_VHT_BW_20UUL 24#define IEEE80211_RADIOTAP_VHT_BW_20UUU 25 +/* for IEEE80211_RADIOTAP_TIMESTAMP */ +#define IEEE80211_RADIOTAP_TS_UNIT_MASK 0x0F +#define IEEE80211_RADIOTAP_TS_UNIT_MSEC 0x00 +#define IEEE80211_RADIOTAP_TS_UNIT_USEC 0x01 +#define IEEE80211_RADIOTAP_TS_UNIT_NSEC 0x02 +#define IEEE80211_RADIOTAP_TS_SPOS_MASK 0xF0 +#define IEEE80211_RADIOTAP_TS_SPOS_SHIFT 4 +#define IEEE80211_RADIOTAP_TS_SPOS_MPDU 0x0 +#define IEEE80211_RADIOTAP_TS_SPOS_ACQ 0x1 +#define IEEE80211_RADIOTAP_TS_SPOS_EOF 0x2 +#define IEEE80211_RADIOTAP_TS_SPOS_UNDEF 0xF + +#define IEEE80211_RADIOTAP_TS_FLG_32BIT 0x01 +#define IEEE80211_RADIOTAP_TS_FLG_ACCURACY 0x02#endif /* IEEE80211_RADIOTAP_H */
epan/dissectors/packet-ieee80211-radiotap-iter.c +2 -1
@@ -62,7 +62,8 @@ static const struct radiotap_align_size rtap_namespace_sizes[] = { /* [IEEE80211_RADIOTAP_XCHANNEL] = 18 */ { 0, 0 }, /* Unofficial, used by FreeBSD */ /* [IEEE80211_RADIOTAP_MCS] = 19 */ { 1, 3 }, /* [IEEE80211_RADIOTAP_AMPDU_STATUS] = 20 */ { 4, 8 }, - /* [IEEE80211_RADIOTAP_VHT] = 21 */ { 2, 12 } + /* [IEEE80211_RADIOTAP_VHT] = 21 */ { 2, 12 }, + /* [IEEE80211_RADIOTAP_TIMESTAMP] = 22 */ { 8, 12 }/* * add more here as they are defined in
epan/dissectors/packet-ieee80211-radiotap.c +107 -1
162 lines not on this page · raw message
drivers/net/wireless/mac80211_hwsim.c +12 -0
@@ -551,6 +551,13 @@ struct hwsim_radiotap_hdr {u8 rt_rate;__le16 rt_channel;__le16 rt_chbitmask; +__le16 reserved; +struct { +__le64 ts; +__le16 accuracy; +u8 unit_pos; +u8 flags; + } ts; } __packed;struct hwsim_radiotap_ack_hdr {
@@ -831,6 +838,7 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, hdr->hdr.it_present =cpu_to_le32 ((1 <<IEEE80211_RADIOTAP_FLAGS ) | (1 <<IEEE80211_RADIOTAP_RATE ) | (1 <<IEEE80211_RADIOTAP_TSFT ) | +BIT (22 ) | (1 <<IEEE80211_RADIOTAP_CHANNEL )); hdr->rt_tsft =__mac80211_hwsim_get_tsf (data); hdr->rt_flags =0 ;
@@ -842,6 +850,10 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,else flags |=IEEE80211_CHAN_CCK ; hdr->rt_chbitmask =cpu_to_le16 (flags); + hdr->ts.ts =cpu_to_le64 (ktime_get_boot_ns ()); + hdr->ts.accuracy =0 ; + hdr->ts.unit_pos =0x22 ; + hdr->ts.flags =0x02 ; skb->dev = hwsim_mon;skb_set_mac_header (skb,0 );
Quoted 5 lines · Johannes Berg
Since there was no objection, reposting as final - will adopt in a week from now unless there are any final objections.
The definition can be found at
http://www.radiotap.org/suggested-fields/timestamp
Does the fact that the Wireshark patch doesn't involve an FT_ABSOLUTE_TIME field mean that the time stamps aren't relative to some fixed time such as the UNIX epoch, so that they can be used to calculate the time between two events but not the wall-clock time of a single event?
Quoted 7 lines · Guy Harris
On Aug 4, 2016, at 10:48 PM, Johannes Berg <[email protected]
Quoted 6 lines
wrote:
Since there was no objection, reposting as final - will adopt in a week
from now unless there are any final objections.
Quoted 8 lines
Quoted 2 lines
The definition can be found at
http://www.radiotap.org/suggested-fields/timestampDoes the fact that the Wireshark patch doesn't involve an
FT_ABSOLUTE_TIMEfield mean that the time stamps aren't relative to some fixed time such as the UNIX epoch, so that they can be used to calculate the time between two events but not the wall-clock time of a single event?
I don't see a way to make them absolute, but it's something we could consider adding perhaps? Maybe eventually wifi hardware will have some clock sync with something.
Right now my main use-case is going to be exporting the timestamp from the hardware, which isn't like the existing MACTIME, and then using that to synchronize two or more captures (by finding common frames, like beacons).
I must admit I hadn't thought about absolute times in the context of radiotap at all.
johannes
Quoted 2 lines
I look at the absolute timestamp, but we can't really do that right now since we don't have hardware sync. If anyone wants to do it in some way, please come up with an extension (to this field, or new, or whatever is needed)
johannes