Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / net / wireless / nl80211.c
index 7257164af91bf2f80318bd88d6ed74071df9ce38..233c54e45092a5a386ba3a5726f7d51ee28d93d5 100644 (file)
@@ -6033,7 +6033,6 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
        const struct cfg80211_bss_ies *ies;
        void *hdr;
        struct nlattr *bss;
-       bool tsf = false;
 
        ASSERT_WDEV_LOCK(wdev);
 
@@ -6060,18 +6059,27 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
                goto nla_put_failure;
 
        rcu_read_lock();
+       /* indicate whether we have probe response data or not */
+       if (rcu_access_pointer(res->proberesp_ies) &&
+           nla_put_flag(msg, NL80211_BSS_PRESP_DATA))
+               goto fail_unlock_rcu;
+
+       /* this pointer prefers to be pointed to probe response data
+        * but is always valid
+        */
        ies = rcu_dereference(res->ies);
        if (ies) {
                if (nla_put_u64(msg, NL80211_BSS_TSF, ies->tsf))
                        goto fail_unlock_rcu;
-               tsf = true;
                if (ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS,
                                        ies->len, ies->data))
                        goto fail_unlock_rcu;
        }
+
+       /* and this pointer is always (unless driver didn't know) beacon data */
        ies = rcu_dereference(res->beacon_ies);
-       if (ies) {
-               if (!tsf && nla_put_u64(msg, NL80211_BSS_TSF, ies->tsf))
+       if (ies && ies->from_beacon) {
+               if (nla_put_u64(msg, NL80211_BSS_BEACON_TSF, ies->tsf))
                        goto fail_unlock_rcu;
                if (ies->len && nla_put(msg, NL80211_BSS_BEACON_IES,
                                        ies->len, ies->data))