TDLS: Declare tdls_testing as extern in a header file
[mech_eap.git] / wpa_supplicant / ibss_rsn.c
index 3e5d412..c00db31 100644 (file)
@@ -72,7 +72,7 @@ static int supp_ether_send(void *ctx, const u8 *dest, u16 proto, const u8 *buf,
        if (wpa_s->l2)
                return l2_packet_send(wpa_s->l2, dest, proto, buf, len);
 
-       return wpa_drv_send_eapol(wpa_s, dest, proto, buf, len);
+       return -1;
 }
 
 
@@ -230,7 +230,7 @@ static int ibss_rsn_supp_init(struct ibss_rsn_peer *peer, const u8 *own_addr,
        wpa_sm_set_param(peer->supp, WPA_PARAM_PAIRWISE, WPA_CIPHER_CCMP);
        wpa_sm_set_param(peer->supp, WPA_PARAM_GROUP, WPA_CIPHER_CCMP);
        wpa_sm_set_param(peer->supp, WPA_PARAM_KEY_MGMT, WPA_KEY_MGMT_PSK);
-       wpa_sm_set_pmk(peer->supp, psk, PMK_LEN);
+       wpa_sm_set_pmk(peer->supp, psk, PMK_LEN, NULL, NULL);
 
        peer->supp_ie_len = sizeof(peer->supp_ie);
        if (wpa_sm_set_assoc_wpa_ie_default(peer->supp, peer->supp_ie,
@@ -257,7 +257,8 @@ static void auth_logger(void *ctx, const u8 *addr, logger_level level,
 }
 
 
-static const u8 * auth_get_psk(void *ctx, const u8 *addr, const u8 *prev_psk)
+static const u8 * auth_get_psk(void *ctx, const u8 *addr,
+                              const u8 *p2p_dev_addr, const u8 *prev_psk)
 {
        struct ibss_rsn *ibss_rsn = ctx;
        wpa_printf(MSG_DEBUG, "AUTH: %s (addr=" MACSTR " prev_psk=%p)",
@@ -282,7 +283,7 @@ static int auth_send_eapol(void *ctx, const u8 *addr, const u8 *data,
                return l2_packet_send(wpa_s->l2, addr, ETH_P_EAPOL, data,
                                      data_len);
 
-       return wpa_drv_send_eapol(wpa_s, addr, ETH_P_EAPOL, data, data_len);
+       return -1;
 }
 
 
@@ -444,7 +445,7 @@ static int ibss_rsn_auth_init_group(struct ibss_rsn *ibss_rsn,
 static int ibss_rsn_auth_init(struct ibss_rsn *ibss_rsn,
                              struct ibss_rsn_peer *peer)
 {
-       peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr);
+       peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr, NULL);
        if (peer->auth == NULL) {
                wpa_printf(MSG_DEBUG, "AUTH: wpa_auth_sta_init() failed");
                return -1;
@@ -570,6 +571,9 @@ int ibss_rsn_start(struct ibss_rsn *ibss_rsn, const u8 *addr)
        struct ibss_rsn_peer *peer;
        int res;
 
+       if (!ibss_rsn)
+               return -1;
+
        /* if the peer already exists, exit immediately */
        peer = ibss_rsn_get_peer(ibss_rsn, addr);
        if (peer)
@@ -589,7 +593,7 @@ int ibss_rsn_start(struct ibss_rsn *ibss_rsn, const u8 *addr)
                peer->authentication_status |= IBSS_RSN_AUTH_BY_US;
                return ibss_rsn_auth_init(ibss_rsn, peer);
        } else {
-               os_get_time(&peer->own_auth_tx);
+               os_get_reltime(&peer->own_auth_tx);
                eloop_register_timeout(1, 0, ibss_rsn_auth_timeout, peer, NULL);
        }
 
@@ -693,7 +697,8 @@ void ibss_rsn_deinit(struct ibss_rsn *ibss_rsn)
                ibss_rsn_free(prev);
        }
 
-       wpa_deinit(ibss_rsn->auth_group);
+       if (ibss_rsn->auth_group)
+               wpa_deinit(ibss_rsn->auth_group);
        os_free(ibss_rsn);
 
 }
@@ -833,9 +838,9 @@ static void ibss_rsn_handle_auth_1_of_2(struct ibss_rsn *ibss_rsn,
        if (peer &&
            peer->authentication_status & IBSS_RSN_AUTH_EAPOL_BY_PEER) {
                if (peer->own_auth_tx.sec) {
-                       struct os_time now, diff;
-                       os_get_time(&now);
-                       os_time_sub(&now, &peer->own_auth_tx, &diff);
+                       struct os_reltime now, diff;
+                       os_get_reltime(&now);
+                       os_reltime_sub(&now, &peer->own_auth_tx, &diff);
                        if (diff.sec == 0 && diff.usec < 500000) {
                                wpa_printf(MSG_DEBUG, "RSN: Skip IBSS reinit since only %u usec from own Auth frame TX",
                                           (int) diff.usec);