RSN IBSS: RX GTK configuration with nl80211
authorJouni Malinen <j@w1.fi>
Sun, 5 Dec 2010 04:31:22 +0000 (20:31 -0800)
committerJouni Malinen <j@w1.fi>
Sun, 5 Dec 2010 04:31:22 +0000 (20:31 -0800)
This add preliminary code for setting the per-STA RX GTK for
RSN IBSS when nl80211 drivers. For some reason, this does not
seem to fully work, but at least driver_nl80211.c is now aware of
what kind of key is being set and the whatever is missing from
making this key configuration go through should be specific to
nl80211/cfg80211.

src/drivers/driver_nl80211.c
wpa_supplicant/ibss_rsn.c

index 0854a3f..9bd4061 100644 (file)
@@ -2576,6 +2576,12 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
        {
                wpa_printf(MSG_DEBUG, "   addr=" MACSTR, MAC2STR(addr));
                NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
+
+               if (alg != WPA_ALG_WEP && key_idx && !set_tx) {
+                       wpa_printf(MSG_DEBUG, "   RSN IBSS RX GTK");
+                       NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE,
+                                   NL80211_KEYTYPE_GROUP);
+               }
        }
        NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_idx);
        NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
index 0e33253..fa99c08 100644 (file)
@@ -125,6 +125,8 @@ static int supp_set_key(void *ctx, enum wpa_alg alg,
                }
        }
 
+       if (is_broadcast_ether_addr(addr) && peer->addr)
+               addr = peer->addr;
        return wpa_drv_set_key(peer->ibss_rsn->wpa_s, alg, addr, key_idx,
                               set_tx, seq, seq_len, key, key_len);
 }
@@ -153,6 +155,12 @@ static void supp_cancel_auth_timeout(void *ctx)
 }
 
 
+static void supp_deauthenticate(void * ctx, int reason_code)
+{
+       wpa_printf(MSG_DEBUG, "SUPP: %s (TODO)", __func__);
+}
+
+
 int ibss_rsn_supp_init(struct ibss_rsn_peer *peer, const u8 *own_addr,
                       const u8 *psk)
 {
@@ -170,6 +178,7 @@ int ibss_rsn_supp_init(struct ibss_rsn_peer *peer, const u8 *own_addr,
        ctx->get_network_ctx = supp_get_network_ctx;
        ctx->mlme_setprotection = supp_mlme_setprotection;
        ctx->cancel_auth_timeout = supp_cancel_auth_timeout;
+       ctx->deauthenticate = supp_deauthenticate;
        peer->supp = wpa_sm_init(ctx);
        if (peer->supp == NULL) {
                wpa_printf(MSG_DEBUG, "SUPP: wpa_sm_init() failed");