From eaa8eefed177f8301faa8281a24f4a5003318ac3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 7 Apr 2015 12:44:39 +0300 Subject: [PATCH] Replace MAX_SSID_LEN with SSID_MAX_LEN This makes source code more consistent. The use within Android driver interface is left as-is to avoid changes in the old PNO interface definition. Signed-off-by: Jouni Malinen --- wpa_supplicant/config.c | 4 ++-- wpa_supplicant/config.h | 3 ++- wpa_supplicant/config_ssid.h | 2 -- wpa_supplicant/ctrl_iface.c | 2 +- wpa_supplicant/dbus/dbus_new_handlers.c | 4 ++-- wpa_supplicant/events.c | 2 +- wpa_supplicant/wpa_supplicant.c | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index cf1617431..e1f4883ac 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1814,7 +1814,7 @@ static char * wpa_config_write_mesh_basic_rates(const struct parse_data *data, * functions. */ static const struct parse_data ssid_fields[] = { - { STR_RANGE(ssid, 0, MAX_SSID_LEN) }, + { STR_RANGE(ssid, 0, SSID_MAX_LEN) }, { INT_RANGE(scan_ssid, 0, 1) }, { FUNC(bssid) }, { FUNC(bssid_blacklist) }, @@ -2956,7 +2956,7 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var, if (os_strcmp(var, "excluded_ssid") == 0) { struct excluded_ssid *e; - if (len > MAX_SSID_LEN) { + if (len > SSID_MAX_LEN) { wpa_printf(MSG_ERROR, "Line %d: invalid " "excluded_ssid length %d", line, (int) len); os_free(val); diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 34b754e09..16681fdb0 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -37,6 +37,7 @@ #include "config_ssid.h" #include "wps/wps.h" +#include "common/ieee802_11_defs.h" #include "common/ieee802_11_common.h" @@ -241,7 +242,7 @@ struct wpa_cred { char *phase2; struct excluded_ssid { - u8 ssid[MAX_SSID_LEN]; + u8 ssid[SSID_MAX_LEN]; size_t ssid_len; } *excluded_ssid; size_t num_excluded_ssid; diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 23a37cc35..dbb5a47a9 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -13,8 +13,6 @@ #include "utils/list.h" #include "eap_peer/eap_config.h" -#define MAX_SSID_LEN 32 - #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) #define DEFAULT_EAPOL_FLAGS (EAPOL_FLAG_REQUIRE_KEY_UNICAST | \ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 35eab274f..a6aafee0b 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -1729,7 +1729,7 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, if (ssid) { u8 *_ssid = ssid->ssid; size_t ssid_len = ssid->ssid_len; - u8 ssid_buf[MAX_SSID_LEN]; + u8 ssid_buf[SSID_MAX_LEN]; if (ssid_len == 0) { int _res = wpa_drv_get_ssid(wpa_s, ssid_buf); if (_res < 0) diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 66ee32fb9..d695d1bc0 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -1034,10 +1034,10 @@ static int wpas_dbus_get_scan_ssids(DBusMessage *message, DBusMessageIter *var, dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len); - if (len > MAX_SSID_LEN) { + if (len > SSID_MAX_LEN) { wpa_printf(MSG_DEBUG, "%s[dbus]: SSID too long (len=%d max_len=%d)", - __func__, len, MAX_SSID_LEN); + __func__, len, SSID_MAX_LEN); *reply = wpas_dbus_error_invalid_args( message, "Invalid SSID: too long"); return -1; diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index a81cead10..d086624b2 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -158,7 +158,7 @@ static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s) static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) { struct wpa_ssid *ssid, *old_ssid; - u8 drv_ssid[MAX_SSID_LEN]; + u8 drv_ssid[SSID_MAX_LEN]; size_t drv_ssid_len; int res; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2ba9c3844..b96fd8e72 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2872,7 +2872,7 @@ int wpa_supplicant_set_debug_params(struct wpa_global *global, int debug_level, struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s) { struct wpa_ssid *entry; - u8 ssid[MAX_SSID_LEN]; + u8 ssid[SSID_MAX_LEN]; int res; size_t ssid_len; u8 bssid[ETH_ALEN];