]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
VLAN: Simplify no-WEP with VLAN check
authorJouni Malinen <j@w1.fi>
Wed, 7 Aug 2013 09:24:18 +0000 (12:24 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 7 Aug 2013 09:24:18 +0000 (12:24 +0300)
No need to have a local variable and two #ifndef blocks for this.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/ieee802_1x.c

index d9f6b38f2df362404e4879fab81d3c3a6b3a6ea9..01fcf2c29bbbfa85dcfc992dd6412e1e1f9c1671 100644 (file)
@@ -190,9 +190,6 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
 {
        struct eapol_authenticator *eapol = hapd->eapol_auth;
        struct eapol_state_machine *sm = sta->eapol_sm;
-#ifndef CONFIG_NO_VLAN
-       int vlan_id;
-#endif /* CONFIG_NO_VLAN */
 
        if (sm == NULL || !sm->eap_if->eapKeyData)
                return;
@@ -201,15 +198,12 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
                   MAC2STR(sta->addr));
 
 #ifndef CONFIG_NO_VLAN
-       vlan_id = sta->vlan_id;
-       if (vlan_id < 0 || vlan_id > MAX_VLAN_ID)
-               vlan_id = 0;
-
-       if (vlan_id) {
+       if (sta->vlan_id > 0 && sta->vlan_id <= MAX_VLAN_ID) {
                wpa_printf(MSG_ERROR, "Using WEP with vlans is not supported.");
                return;
        }
 #endif /* CONFIG_NO_VLAN */
+
        if (eapol->default_wep_key) {
                ieee802_1x_tx_key_one(hapd, sta, eapol->default_wep_key_idx, 1,
                                      eapol->default_wep_key,