static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) { int i; hostapd_broadcast_wep_set(hapd); if (hapd->conf->ssid.wep.default_len) { hostapd_set_privacy(hapd, 1); return 0; } /* * When IEEE 802.1X is not enabled, the driver may need to know how to * set authentication algorithms for static WEP. */ hostapd_drv_set_authmode(hapd, hapd->conf->auth_algs); for (i = 0; i < 4; i++) { if (hapd->conf->ssid.wep.key[i] && hostapd_drv_set_key(iface, 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_WARNING, "Could not set WEP " "encryption."); return -1; } if (hapd->conf->ssid.wep.key[i] && i == hapd->conf->ssid.wep.idx) hostapd_set_privacy(hapd, 1); } return 0; }
static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) { int i; hostapd_broadcast_wep_set(hapd); if (hapd->conf->ssid.wep.default_len) { hostapd_set_privacy(hapd, 1); return 0; } for (i = 0; i < 4; i++) { if (hapd->conf->ssid.wep.key[i] && hostapd_drv_set_key(iface, 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_WARNING, "Could not set WEP " "encryption."); return -1; } if (hapd->conf->ssid.wep.key[i] && i == hapd->conf->ssid.wep.idx) hostapd_set_privacy(hapd, 1); } return 0; }