mac80211_hwsim: fill boottime_ns in netlink RX path
authorJohannes Berg <johannes.berg@intel.com>
Mon, 29 Jul 2019 16:06:05 +0000 (18:06 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 31 Jul 2019 08:51:43 +0000 (10:51 +0200)
Give a proper boottime_ns value for netlink RX to avoid scan
issues here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20190729160605.1074-1-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c

index 23692229dacf1f5283a85654207d6fc9cf0e708a..3aeff7a3c3d80e60717155fd260fc7e28c61c750 100644 (file)
@@ -3228,6 +3228,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
 {
        struct mac80211_hwsim_data *data2;
        struct ieee80211_rx_status rx_status;
+       struct ieee80211_hdr *hdr;
        const u8 *dst;
        int frame_data_len;
        void *frame_data;
@@ -3294,6 +3295,12 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
        rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
        rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]);
 
+       hdr = (void *)skb->data;
+
+       if (ieee80211_is_beacon(hdr->frame_control) ||
+           ieee80211_is_probe_resp(hdr->frame_control))
+               rx_status.boottime_ns = ktime_get_boottime_ns();
+
        memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
        data2->rx_pkts++;
        data2->rx_bytes += skb->len;