rsn_supp: Do not track expiration time
authorJohannes Berg <johannes.berg@intel.com>
Mon, 16 Dec 2013 20:08:31 +0000 (21:08 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 24 Dec 2013 05:33:25 +0000 (07:33 +0200)
The eloop already tracks the expiration/lifetime, and the expiration
isn't really used, so remove it. It should otherwise have used monotonic
time, but since it's not actually used, we can remove it instead.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

src/rsn_supp/peerkey.c
src/rsn_supp/peerkey.h

index 789ac25..76714f8 100644 (file)
@@ -516,7 +516,6 @@ static int wpa_supplicant_process_smk_m45(
        struct wpa_peerkey *peerkey;
        struct wpa_eapol_ie_parse kde;
        u32 lifetime;
-       struct os_time now;
 
        if (!sm->peerkey_enabled || sm->proto != WPA_PROTO_RSN) {
                wpa_printf(MSG_DEBUG, "RSN: SMK handshake not allowed for "
@@ -568,10 +567,8 @@ static int wpa_supplicant_process_smk_m45(
        lifetime = WPA_GET_BE32(kde.lifetime);
        wpa_printf(MSG_DEBUG, "RSN: SMK lifetime %u seconds", lifetime);
        if (lifetime > 1000000000)
-               lifetime = 1000000000; /* avoid overflowing expiration time */
+               lifetime = 1000000000; /* avoid overflowing eloop time */
        peerkey->lifetime = lifetime;
-       os_get_time(&now);
-       peerkey->expiration = now.sec + lifetime;
        eloop_register_timeout(lifetime, 0, wpa_supplicant_smk_timeout,
                               sm, peerkey);
 
@@ -736,7 +733,6 @@ static void wpa_supplicant_update_smk_lifetime(struct wpa_sm *sm,
                                               struct wpa_eapol_ie_parse *kde)
 {
        u32 lifetime;
-       struct os_time now;
 
        if (kde->lifetime == NULL || kde->lifetime_len < sizeof(lifetime))
                return;
@@ -755,8 +751,6 @@ static void wpa_supplicant_update_smk_lifetime(struct wpa_sm *sm,
                   lifetime, peerkey->lifetime);
        peerkey->lifetime = lifetime;
 
-       os_get_time(&now);
-       peerkey->expiration = now.sec + lifetime;
        eloop_cancel_timeout(wpa_supplicant_smk_timeout, sm, peerkey);
        eloop_register_timeout(lifetime, 0, wpa_supplicant_smk_timeout,
                               sm, peerkey);
index b8845f7..f420691 100644 (file)
@@ -24,7 +24,6 @@ struct wpa_peerkey {
        int smk_complete;
        u8 smkid[PMKID_LEN];
        u32 lifetime;
-       os_time_t expiration;
        int cipher; /* Selected cipher (WPA_CIPHER_*) */
        u8 replay_counter[WPA_REPLAY_COUNTER_LEN];
        int replay_counter_set;