aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-01-06 17:12:09 (GMT)
committerJouni Malinen <j@w1.fi>2008-01-06 17:12:09 (GMT)
commitae2b75a5e85cd0565e18ce94d88a14ea7412b7ef (patch)
tree6ac3e93be9d86ec72dac42378aeebe565413234a /hostapd
parent627583bda727bbb482d1b4c278b356e48c714c53 (diff)
downloadhostap-history-ae2b75a5e85cd0565e18ce94d88a14ea7412b7ef.zip
hostap-history-ae2b75a5e85cd0565e18ce94d88a14ea7412b7ef.tar.gz
hostap-history-ae2b75a5e85cd0565e18ce94d88a14ea7412b7ef.tar.bz2
WPS: Set authentication and encryption types
Configure enabled authentication and encryption types to WPS Registrar and match these with the supported types of the WPS Enrollee to select the best available combination for the Credential data.
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/hostapd.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/hostapd/hostapd.c b/hostapd/hostapd.c
index 90b3c6c..24f0c90 100644
--- a/hostapd/hostapd.c
+++ b/hostapd/hostapd.c
@@ -44,6 +44,7 @@
#include "version.h"
#include "l2_packet/l2_packet.h"
#include "wps/wps.h"
+#include "wps/wps_defs.h"
static int hostapd_radius_get_eap_user(void *ctx, const u8 *identity,
@@ -1170,6 +1171,47 @@ static int hostapd_setup_wps(struct hostapd_data *hapd,
cfg.ssid = (const u8 *) hapd->conf->ssid.ssid;
cfg.ssid_len = hapd->conf->ssid.ssid_len;
+ if (conf->wpa & WPA_PROTO_RSN) {
+ if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
+ cfg.auth_types |= WPS_AUTH_WPA2PSK;
+ if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
+ cfg.auth_types |= WPS_AUTH_WPA2;
+
+ if (conf->rsn_pairwise & WPA_CIPHER_CCMP)
+ cfg.encr_types |= WPS_ENCR_AES;
+ if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
+ cfg.encr_types |= WPS_ENCR_TKIP;
+ }
+
+ if (conf->wpa & WPA_PROTO_WPA) {
+ if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
+ cfg.auth_types |= WPS_AUTH_WPAPSK;
+ if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
+ cfg.auth_types |= WPS_AUTH_WPA;
+
+ if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
+ cfg.encr_types |= WPS_ENCR_AES;
+ if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
+ cfg.encr_types |= WPS_ENCR_TKIP;
+ }
+
+ if (conf->ssid.security_policy == SECURITY_PLAINTEXT) {
+ cfg.encr_types |= WPS_ENCR_NONE;
+ cfg.auth_types |= WPS_AUTH_OPEN;
+ } else if (conf->ssid.security_policy == SECURITY_STATIC_WEP) {
+ cfg.encr_types |= WPS_ENCR_WEP;
+ if (conf->auth_algs & WPA_AUTH_ALG_OPEN)
+ cfg.auth_types |= WPS_AUTH_OPEN;
+ if (conf->auth_algs & WPA_AUTH_ALG_SHARED)
+ cfg.auth_types |= WPS_AUTH_SHARED;
+ } else if (conf->ssid.security_policy == SECURITY_IEEE_802_1X) {
+ cfg.auth_types |= WPS_AUTH_OPEN;
+ if (conf->default_wep_key_len)
+ cfg.encr_types |= WPS_ENCR_WEP;
+ else
+ cfg.encr_types |= WPS_ENCR_NONE;
+ }
+
hapd->wps_registrar = wps_registrar_init(&cfg);
if (hapd->wps_registrar == NULL) {
printf("Failed to initialize WPS Registrar\n");