ath6kl: Report PMKSA candidate events through cfg80211
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 21 Sep 2011 13:57:29 +0000 (16:57 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 22 Sep 2011 07:40:40 +0000 (10:40 +0300)
This allows RSN pre-authentication to be used when roaming decisions are
done in the target.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/wmi.c
drivers/net/wireless/ath/ath6kl/wmi.h

index b90d116c018ce1f554217fa698e2815f38c5fbf0..47fbb8e7686be5d6c0241ba7b3b3defe2945f0f6 100644 (file)
@@ -1097,6 +1097,35 @@ static int ath6kl_wmi_scan_complete_rx(struct wmi *wmi, u8 *datap, int len)
        return 0;
 }
 
+static int ath6kl_wmi_neighbor_report_event_rx(struct wmi *wmi, u8 *datap,
+                                              int len)
+{
+       struct wmi_neighbor_report_event *ev;
+       u8 i;
+
+       if (len < sizeof(*ev))
+               return -EINVAL;
+       ev = (struct wmi_neighbor_report_event *) datap;
+       if (sizeof(*ev) + ev->num_neighbors * sizeof(struct wmi_neighbor_info)
+           > len) {
+               ath6kl_dbg(ATH6KL_DBG_WMI, "truncated neighbor event "
+                          "(num=%d len=%d)\n", ev->num_neighbors, len);
+               return -EINVAL;
+       }
+       for (i = 0; i < ev->num_neighbors; i++) {
+               ath6kl_dbg(ATH6KL_DBG_WMI, "neighbor %d/%d - %pM 0x%x\n",
+                          i + 1, ev->num_neighbors, ev->neighbor[i].bssid,
+                          ev->neighbor[i].bss_flags);
+               cfg80211_pmksa_candidate_notify(wmi->parent_dev->net_dev, i,
+                                               ev->neighbor[i].bssid,
+                                               !!(ev->neighbor[i].bss_flags &
+                                                  WMI_PREAUTH_CAPABLE_BSS),
+                                               GFP_ATOMIC);
+       }
+
+       return 0;
+}
+
 /*
  * Target is reporting a programming error.  This is for
  * developer aid only.  Target only checks a few common violations
@@ -2870,6 +2899,7 @@ int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb)
                break;
        case WMI_NEIGHBOR_REPORT_EVENTID:
                ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_NEIGHBOR_REPORT_EVENTID\n");
+               ret = ath6kl_wmi_neighbor_report_event_rx(wmi, datap, len);
                break;
        case WMI_SCAN_COMPLETE_EVENTID:
                ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_SCAN_COMPLETE_EVENTID\n");
index d458d6d3a27feeae4143925ebaa8e1d292915489..f8e644d54aa78a042fab20328e33001fe7eea560 100644 (file)
@@ -1439,6 +1439,16 @@ enum wmi_bss_flags {
        WMI_PMKID_VALID_BSS = 0x02,
 };
 
+struct wmi_neighbor_info {
+       u8 bssid[ETH_ALEN];
+       u8 bss_flags; /* enum wmi_bss_flags */
+} __packed;
+
+struct wmi_neighbor_report_event {
+       u8 num_neighbors;
+       struct wmi_neighbor_info neighbor[0];
+} __packed;
+
 /* TKIP MIC Error Event */
 struct wmi_tkip_micerr_event {
        u8 key_id;