From 41d621075e335fdde12a56f37f1d80cbf93b7770 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Mon, 5 Oct 2015 16:14:27 +0200 Subject: [PATCH] Remove WEP support from VLAN Commit d66dcb0d0b584afdbaba00adcfe661741703094d ('WEP: Remove VLAN support from hostapd') already removed VLAN support for WEP encryption, so vlan_setup_encryption_dyn() is no longer needed. Signed-off-by: Michael Braun --- src/ap/sta_info.c | 40 ++++++++-------------------------------- src/ap/vlan_init.c | 37 ++++++++++--------------------------- src/ap/vlan_init.h | 8 -------- 3 files changed, 18 insertions(+), 67 deletions(-) diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index d8ef858da..500beff31 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -847,41 +847,17 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta) } iface = vlan->ifname; - if (vlan_setup_encryption_dyn(hapd, iface) != 0) { - hostapd_logger(hapd, sta->addr, - HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_DEBUG, "could not " - "configure encryption for dynamic VLAN " - "interface for vlan_id=%d", - sta->vlan_id); - } - hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, "added new dynamic VLAN " "interface '%s'", iface); - } else if (vlan && vlan->vlan_id == sta->vlan_id) { - if (vlan->dynamic_vlan > 0) { - vlan->dynamic_vlan++; - hostapd_logger(hapd, sta->addr, - HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_DEBUG, "updated existing " - "dynamic VLAN interface '%s'", iface); - } - - /* - * Update encryption configuration for statically generated - * VLAN interface. This is only used for static WEP - * configuration for the case where hostapd did not yet know - * which keys are to be used when the interface was added. - */ - if (vlan_setup_encryption_dyn(hapd, iface) != 0) { - hostapd_logger(hapd, sta->addr, - HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_DEBUG, "could not " - "configure encryption for VLAN " - "interface for vlan_id=%d", - sta->vlan_id); - } + } else if (vlan && vlan->vlan_id == sta->vlan_id && + vlan->dynamic_vlan > 0) { + vlan->dynamic_vlan++; + hostapd_logger(hapd, sta->addr, + HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_DEBUG, + "updated existing dynamic VLAN interface '%s'", + iface); } /* ref counters have been increased, so mark the station */ diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c index 7228ceedb..e3df164e2 100644 --- a/src/ap/vlan_init.c +++ b/src/ap/vlan_init.c @@ -173,7 +173,16 @@ static int ifconfig_up(const char *if_name) static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan, int existsok) { - int ret; + int ret, i; + + for (i = 0; i < NUM_WEP_KEYS; i++) { + if (!hapd->conf->ssid.wep.key[i]) + continue; + wpa_printf(MSG_ERROR, + "VLAN: Refusing to set up VLAN iface %s with WEP", + vlan->ifname); + return -1; + } if (!if_nametoindex(vlan->ifname)) ret = hostapd_vlan_if_add(hapd, vlan->ifname); @@ -937,32 +946,6 @@ static void full_dynamic_vlan_deinit(struct full_dynamic_vlan *priv) #endif /* CONFIG_FULL_DYNAMIC_VLAN */ -int vlan_setup_encryption_dyn(struct hostapd_data *hapd, const char *dyn_vlan) -{ - int i; - - if (dyn_vlan == NULL) - return 0; - - /* Static WEP keys are set here; IEEE 802.1X and WPA uses their own - * functions for setting up dynamic broadcast keys. */ - for (i = 0; i < 4; i++) { - if (hapd->conf->ssid.wep.key[i] && - hostapd_drv_set_key(dyn_vlan, hapd, WPA_ALG_WEP, NULL, i, - i == hapd->conf->ssid.wep.idx, NULL, 0, - hapd->conf->ssid.wep.key[i], - hapd->conf->ssid.wep.len[i])) - { - wpa_printf(MSG_ERROR, "VLAN: Could not set WEP " - "encryption for dynamic VLAN"); - return -1; - } - } - - return 0; -} - - static int vlan_dynamic_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan) { diff --git a/src/ap/vlan_init.h b/src/ap/vlan_init.h index fc39443e5..aeb2dc6f7 100644 --- a/src/ap/vlan_init.h +++ b/src/ap/vlan_init.h @@ -17,8 +17,6 @@ struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd, struct hostapd_vlan *vlan, int vlan_id); int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id); -int vlan_setup_encryption_dyn(struct hostapd_data *hapd, - const char *dyn_vlan); #else /* CONFIG_NO_VLAN */ static inline int vlan_init(struct hostapd_data *hapd) { @@ -40,12 +38,6 @@ static inline int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id) { return -1; } - -static inline int vlan_setup_encryption_dyn(struct hostapd_data *hapd, - const char *dyn_vlan) -{ - return -1; -} #endif /* CONFIG_NO_VLAN */ #endif /* VLAN_INIT_H */