From 2c8a4eef418a585735f940a27e7705d55476208b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 19 Oct 2010 19:57:01 +0300 Subject: [PATCH] WPS: Update Beacon/ProbeResp IE on wps_version_number changes This test command is supposed to change the WPS version number in all places immediately, so make sure that the IEs used in management frames get updated immediately. --- hostapd/ctrl_iface.c | 3 ++- src/ap/wps_hostapd.c | 14 ++++++++++++++ src/ap/wps_hostapd.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index af83b8d8a..2cdcdc13a 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -661,7 +661,7 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd, } -static int hostapd_ctrl_iface_set(struct hostapd_data *wpa_s, char *cmd) +static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) { char *value; int ret = 0; @@ -687,6 +687,7 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *wpa_s, char *cmd) "version %u.%u", (wps_version_number & 0xf0) >> 4, wps_version_number & 0x0f); + hostapd_wps_update_ie(hapd); } } else if (os_strcasecmp(cmd, "wps_testing_dummy_cred") == 0) { wps_testing_dummy_cred = atoi(value); diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index b2f6a78c0..7ff9aa0c0 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -1272,3 +1272,17 @@ int hostapd_wps_ap_pin_set(struct hostapd_data *hapd, const char *pin, data.timeout = timeout; return hostapd_wps_for_each(hapd, wps_ap_pin_set, &data); } + + +static int wps_update_ie(struct hostapd_data *hapd, void *ctx) +{ + if (hapd->wps) + wps_registrar_update_ie(hapd->wps->registrar); + return 0; +} + + +void hostapd_wps_update_ie(struct hostapd_data *hapd) +{ + return hostapd_wps_for_each(hapd, wps_update_ie, NULL); +} diff --git a/src/ap/wps_hostapd.h b/src/ap/wps_hostapd.h index b9d525aa3..fac736bf4 100644 --- a/src/ap/wps_hostapd.h +++ b/src/ap/wps_hostapd.h @@ -33,6 +33,7 @@ const char * hostapd_wps_ap_pin_random(struct hostapd_data *hapd, int timeout); const char * hostapd_wps_ap_pin_get(struct hostapd_data *hapd); int hostapd_wps_ap_pin_set(struct hostapd_data *hapd, const char *pin, int timeout); +void hostapd_wps_update_ie(struct hostapd_data *hapd); #else /* CONFIG_WPS */