VLAN: Simplify no-WEP with VLAN check

No need to have a local variable and two #ifndef blocks for this.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-08-07 12:24:18 +03:00
parent d66dcb0d0b
commit d2ba3d6bd9

View 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_authenticator *eapol = hapd->eapol_auth;
struct eapol_state_machine *sm = sta->eapol_sm; 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) if (sm == NULL || !sm->eap_if->eapKeyData)
return; return;
@ -201,15 +198,12 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
MAC2STR(sta->addr)); MAC2STR(sta->addr));
#ifndef CONFIG_NO_VLAN #ifndef CONFIG_NO_VLAN
vlan_id = sta->vlan_id; if (sta->vlan_id > 0 && sta->vlan_id <= MAX_VLAN_ID) {
if (vlan_id < 0 || vlan_id > MAX_VLAN_ID)
vlan_id = 0;
if (vlan_id) {
wpa_printf(MSG_ERROR, "Using WEP with vlans is not supported."); wpa_printf(MSG_ERROR, "Using WEP with vlans is not supported.");
return; return;
} }
#endif /* CONFIG_NO_VLAN */ #endif /* CONFIG_NO_VLAN */
if (eapol->default_wep_key) { if (eapol->default_wep_key) {
ieee802_1x_tx_key_one(hapd, sta, eapol->default_wep_key_idx, 1, ieee802_1x_tx_key_one(hapd, sta, eapol->default_wep_key_idx, 1,
eapol->default_wep_key, eapol->default_wep_key,