Accumulative patch from commit 6d28fb9627155929012cda944aacd5a52ce7051a
nl80211: Fetch assoc_freq from scan table for connect event
nl80211: Filter out duplicated BSS table entries from scan results
Update BSS table entry if roaming event indicates frequency change
WPS: Remove obsolete note about lack for WPS ER support
P2P: Include operating class 124 (channels 149,153,157,161)
Include nl80211 driver wrapper in default configuration for hostapd
Better messages when channel cannot be used in AP mode
WPS: Add a workaround for Windows 7 capability discovery for PBC
WPS UPnP: Fix UPnP initialization for non-bridge case with some drivers
Fix regression in RSN pre-authentication candidate list generation
commit 6d28fb9627155929012cda944aacd5a52ce7051a
Change-Id: I3c68dad5fe323b1d86aa585c564a75e4fc1a2ea1
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 25720b8..0a3e76e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -318,6 +318,7 @@
char *upc;
struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
#endif /* CONFIG_WPS */
+ int pbc_in_m1;
#define P2P_ENABLED BIT(0)
#define P2P_GROUP_OWNER BIT(1)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 4e5eb01..32db668 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -784,6 +784,17 @@
return -1;
}
+ /*
+ * WPS UPnP module can be initialized only when the "upnp_iface" is up.
+ * If "interface" and "upnp_iface" are the same (e.g., non-bridge
+ * mode), the interface is up only after driver_commit, so initialize
+ * WPS after driver_commit.
+ */
+ for (j = 0; j < iface->num_bss; j++) {
+ if (hostapd_init_wps_complete(iface->bss[j]))
+ return -1;
+ }
+
if (hapd->setup_complete_cb)
hapd->setup_complete_cb(hapd->setup_complete_cb_ctx);
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index f3fffd7..86f6811 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -603,7 +603,7 @@
/**
* hostapd_select_hw_mode - Select the hardware mode
* @iface: Pointer to interface data.
- * Returns: 0 on success, -1 on failure
+ * Returns: 0 on success, < 0 on failure
*
* Sets up the hardware mode, channel, rates, and passive scanning
* based on the configuration.
@@ -631,17 +631,23 @@
HOSTAPD_LEVEL_WARNING,
"Hardware does not support configured mode "
"(%d)", (int) iface->conf->hw_mode);
- return -1;
+ return -2;
}
ok = 0;
for (j = 0; j < iface->current_mode->num_channels; j++) {
struct hostapd_channel_data *chan =
&iface->current_mode->channels[j];
- if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
- (chan->chan == iface->conf->channel)) {
- ok = 1;
- break;
+ if (chan->chan == iface->conf->channel) {
+ if (chan->flag & HOSTAPD_CHAN_DISABLED) {
+ wpa_printf(MSG_ERROR,
+ "channel [%i] (%i) is disabled for "
+ "use in AP mode, flags: 0x%x",
+ j, chan->chan, chan->flag);
+ } else {
+ ok = 1;
+ break;
+ }
}
}
if (ok && iface->conf->secondary_channel) {
@@ -675,7 +681,7 @@
* the channel automatically */
wpa_printf(MSG_ERROR, "Channel not configured "
"(hw_mode/channel in hostapd.conf)");
- return -1;
+ return -3;
}
if (ok == 0 && iface->conf->channel != 0) {
hostapd_logger(iface->bss[0], NULL,
@@ -693,7 +699,7 @@
hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_WARNING,
"Hardware does not support configured channel");
- return -1;
+ return -4;
}
return 0;
diff --git a/src/ap/hw_features.h b/src/ap/hw_features.h
index 88c2322..b84bca6 100644
--- a/src/ap/hw_features.h
+++ b/src/ap/hw_features.h
@@ -41,7 +41,7 @@
static inline int hostapd_select_hw_mode(struct hostapd_iface *iface)
{
- return -1;
+ return -100;
}
static inline const char * hostapd_hw_mode_txt(int mode)
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index ac0c127..217f9f9 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1701,6 +1701,7 @@
conf.wps = hapd->wps;
conf.fragment_size = hapd->conf->fragment_size;
conf.pwd_group = hapd->conf->pwd_group;
+ conf.pbc_in_m1 = hapd->conf->pbc_in_m1;
os_memset(&cb, 0, sizeof(cb));
cb.eapol_send = ieee802_1x_eapol_send;
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index fcbd89b..fc927f9 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -876,14 +876,6 @@
wps->model_description = hapd->conf->model_description;
wps->model_url = hapd->conf->model_url;
wps->upc = hapd->conf->upc;
-
- if (hostapd_wps_upnp_init(hapd, wps) < 0) {
- wpa_printf(MSG_ERROR, "Failed to initialize WPS UPnP");
- wps_registrar_deinit(wps->registrar);
- os_free(wps->network_key);
- os_free(wps);
- return -1;
- }
#endif /* CONFIG_WPS_UPNP */
hostapd_register_probereq_cb(hapd, hostapd_wps_probe_req_rx, hapd);
@@ -894,6 +886,28 @@
}
+int hostapd_init_wps_complete(struct hostapd_data *hapd)
+{
+ struct wps_context *wps = hapd->wps;
+
+ if (hapd->wps == NULL)
+ return 0;
+
+#ifdef CONFIG_WPS_UPNP
+ if (hostapd_wps_upnp_init(hapd, wps) < 0) {
+ wpa_printf(MSG_ERROR, "Failed to initialize WPS UPnP");
+ wps_registrar_deinit(wps->registrar);
+ os_free(wps->network_key);
+ os_free(wps);
+ hapd->wps = NULL;
+ return -1;
+ }
+#endif /* CONFIG_WPS_UPNP */
+
+ return 0;
+}
+
+
void hostapd_deinit_wps(struct hostapd_data *hapd)
{
eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
diff --git a/src/ap/wps_hostapd.h b/src/ap/wps_hostapd.h
index 338a220..6b28c13 100644
--- a/src/ap/wps_hostapd.h
+++ b/src/ap/wps_hostapd.h
@@ -19,6 +19,7 @@
int hostapd_init_wps(struct hostapd_data *hapd,
struct hostapd_bss_config *conf);
+int hostapd_init_wps_complete(struct hostapd_data *hapd);
void hostapd_deinit_wps(struct hostapd_data *hapd);
void hostapd_update_wps(struct hostapd_data *hapd);
int hostapd_wps_add_pin(struct hostapd_data *hapd, const u8 *addr,
@@ -50,6 +51,11 @@
{
}
+static inline int hostapd_init_wps_complete(struct hostapd_data *hapd)
+{
+ return 0;
+}
+
static inline void hostapd_update_wps(struct hostapd_data *hapd)
{
}