Added build option for removing VLAN support (CONFIG_NO_VLAN)

This commit is contained in:
Jouni Malinen 2009-01-12 21:39:19 +02:00
parent 71f04b3cf9
commit 30b32314eb
6 changed files with 59 additions and 3 deletions

View File

@ -45,7 +45,7 @@ OBJS = hostapd.o ieee802_1x.o eapol_sm.o \
hw_features.o \
drv_callbacks.o \
tkip_countermeasures.o \
mlme.o vlan_init.o wpa_auth_ie.o
mlme.o wpa_auth_ie.o
OBJS += ../src/utils/eloop.o
OBJS += ../src/utils/common.o
@ -71,6 +71,12 @@ else
OBJS += accounting.o
endif
ifdef CONFIG_NO_VLAN
CFLAGS += -DCONFIG_NO_VLAN
else
OBJS += vlan_init.o
endif
OBJS += ../src/crypto/md5.o
OBJS += ../src/crypto/rc4.o
OBJS += ../src/crypto/md4.o

View File

@ -34,6 +34,7 @@
extern struct wpa_driver_ops *hostapd_drivers[];
#ifndef CONFIG_NO_VLAN
static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
const char *fname)
{
@ -113,6 +114,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
return 0;
}
#endif /* CONFIG_NO_VLAN */
static void hostapd_config_free_vlan(struct hostapd_bss_config *bss)
@ -2046,6 +2048,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
"key '%s'", line, buf);
errors++;
}
#ifndef CONFIG_NO_VLAN
} else if (os_strcmp(buf, "dynamic_vlan") == 0) {
bss->ssid.dynamic_vlan = atoi(pos);
} else if (os_strcmp(buf, "vlan_file") == 0) {
@ -2058,6 +2061,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
} else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
bss->ssid.vlan_tagged_interface = os_strdup(pos);
#endif /* CONFIG_FULL_DYNAMIC_VLAN */
#endif /* CONFIG_NO_VLAN */
} else if (os_strcmp(buf, "passive_scan_interval") == 0) {
conf->passive_scan_interval = atoi(pos);
} else if (os_strcmp(buf, "passive_scan_listen") == 0) {

View File

@ -146,3 +146,6 @@ CONFIG_IPV6=y
# Remove support for RADIUS
#CONFIG_NO_RADIUS=y
# Remove support for VLANs
#CONFIG_NO_VLAN=y

View File

@ -185,6 +185,7 @@ static void ieee802_1x_tx_key_one(struct hostapd_data *hapd,
}
#ifndef CONFIG_NO_VLAN
static struct hostapd_wep_keys *
ieee802_1x_group_alloc(struct hostapd_data *hapd, const char *ifname)
{
@ -279,13 +280,16 @@ ieee802_1x_get_group(struct hostapd_data *hapd, struct hostapd_ssid *ssid,
return ssid->dyn_vlan_keys[vlan_id];
}
#endif /* CONFIG_NO_VLAN */
void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
{
struct hostapd_wep_keys *key = NULL;
struct eapol_state_machine *sm = sta->eapol_sm;
#ifndef CONFIG_NO_VLAN
struct hostapd_wep_keys *key = NULL;
int vlan_id;
#endif /* CONFIG_NO_VLAN */
if (sm == NULL || !sm->eap_if->eapKeyData)
return;
@ -293,6 +297,7 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
wpa_printf(MSG_DEBUG, "IEEE 802.1X: Sending EAPOL-Key(s) to " MACSTR,
MAC2STR(sta->addr));
#ifndef CONFIG_NO_VLAN
vlan_id = sta->vlan_id;
if (vlan_id < 0 || vlan_id > MAX_VLAN_ID)
vlan_id = 0;
@ -303,7 +308,9 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
ieee802_1x_tx_key_one(hapd, sta, key->idx, 1,
key->key[key->idx],
key->len[key->idx]);
} else if (hapd->default_wep_key) {
} else
#endif /* CONFIG_NO_VLAN */
if (hapd->default_wep_key) {
ieee802_1x_tx_key_one(hapd, sta, hapd->default_wep_key_idx, 1,
hapd->default_wep_key,
hapd->conf->default_wep_key_len);
@ -1299,6 +1306,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
case RADIUS_CODE_ACCESS_ACCEPT:
if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
sta->vlan_id = 0;
#ifndef CONFIG_NO_VLAN
else {
old_vlanid = sta->vlan_id;
sta->vlan_id = radius_msg_get_vlanid(msg);
@ -1319,6 +1327,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
"ID in Access-Accept");
break;
}
#endif /* CONFIG_NO_VLAN */
ap_sta_bind_vlan(hapd, sta, old_vlanid);

View File

@ -518,6 +518,7 @@ void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
int old_vlanid)
{
#ifndef CONFIG_NO_VLAN
const char *iface;
struct hostapd_vlan *vlan = NULL;
@ -616,6 +617,9 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
return hostapd_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
#else /* CONFIG_NO_VLAN */
return 0;
#endif /* CONFIG_NO_VLAN */
}

View File

@ -16,6 +16,7 @@
#ifndef VLAN_INIT_H
#define VLAN_INIT_H
#ifndef CONFIG_NO_VLAN
int vlan_init(struct hostapd_data *hapd);
void vlan_deinit(struct hostapd_data *hapd);
int vlan_reconfig(struct hostapd_data *hapd, struct hostapd_config *oldconf,
@ -27,5 +28,34 @@ int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id);
int vlan_setup_encryption_dyn(struct hostapd_data *hapd,
struct hostapd_ssid *mssid,
const char *dyn_vlan);
#else /* CONFIG_NO_VLAN */
static inline int vlan_init(struct hostapd_data *hapd)
{
return 0;
}
static inline void vlan_deinit(struct hostapd_data *hapd)
{
}
static inline struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd,
struct hostapd_vlan *vlan,
int vlan_id)
{
return NULL;
}
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,
struct hostapd_ssid *mssid,
const char *dyn_vlan)
{
return -1;
}
#endif /* CONFIG_NO_VLAN */
#endif /* VLAN_INIT_H */