Replace int status/reason_code with u16 variable

These cases are for the IEEE 802.11 Status Code and Reason Code and
those fields are unsigned 16 bit values, so use the more appropriate
type consistently. This is mainly to document the uses and to make the
source code easier to understand.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-04-22 20:17:38 +03:00
parent cfde99a84b
commit 4be17ffbd9
20 changed files with 38 additions and 38 deletions

View file

@ -2337,7 +2337,7 @@ struct wpa_driver_ops {
*
* Returns: 0 on success, -1 on failure
*/
int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
int (*deauthenticate)(void *priv, const u8 *addr, u16 reason_code);
/**
* associate - Request driver to associate
@ -2806,7 +2806,7 @@ struct wpa_driver_ops {
* a Deauthentication frame to be sent to it.
*/
int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
int reason);
u16 reason);
/**
* sta_disassoc - Disassociate a station (AP only)
@ -2820,7 +2820,7 @@ struct wpa_driver_ops {
* a Disassociation frame to be sent to it.
*/
int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
int reason);
u16 reason);
/**
* sta_remove - Remove a station entry (AP only)

View file

@ -86,7 +86,7 @@ struct atheros_driver_data {
};
static int atheros_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
int reason_code);
u16 reason_code);
static int atheros_set_privacy(void *priv, int enabled);
static const char * athr_get_ioctl_name(int op)
@ -761,7 +761,7 @@ atheros_set_opt_ie(void *priv, const u8 *ie, size_t ie_len)
static int
atheros_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
int reason_code)
u16 reason_code)
{
struct atheros_driver_data *drv = priv;
struct ieee80211req_mlme mlme;
@ -785,7 +785,7 @@ atheros_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
static int
atheros_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
int reason_code)
u16 reason_code)
{
struct atheros_driver_data *drv = priv;
struct ieee80211req_mlme mlme;

View file

@ -663,7 +663,7 @@ rtbuf_len(void)
#undef WPA_OUI_TYPE
static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
int reason_code);
u16 reason_code);
static const char *
ether_sprintf(const u8 *addr)
@ -755,7 +755,7 @@ bsd_read_sta_driver_data(void *priv, struct hostap_sta_driver_data *data,
}
static int
bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code)
bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, u16 reason_code)
{
return bsd_send_mlme_param(priv, IEEE80211_MLME_DEAUTH, reason_code,
addr);
@ -763,7 +763,7 @@ bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code)
static int
bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
int reason_code)
u16 reason_code)
{
return bsd_send_mlme_param(priv, IEEE80211_MLME_DISASSOC, reason_code,
addr);
@ -1026,7 +1026,7 @@ wpa_driver_bsd_set_drop_unencrypted(void *priv, int enabled)
}
static int
wpa_driver_bsd_deauthenticate(void *priv, const u8 *addr, int reason_code)
wpa_driver_bsd_deauthenticate(void *priv, const u8 *addr, u16 reason_code)
{
return bsd_send_mlme_param(priv, IEEE80211_MLME_DEAUTH, reason_code,
addr);

View file

@ -1028,7 +1028,7 @@ static void hostap_driver_deinit(void *priv)
static int hostap_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
int reason)
u16 reason)
{
struct hostap_driver_data *drv = priv;
struct ieee80211_mgmt mgmt;
@ -1076,7 +1076,7 @@ static int hostap_set_freq(void *priv, struct hostapd_freq_params *freq)
static int hostap_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
int reason)
u16 reason)
{
struct hostap_driver_data *drv = priv;
struct ieee80211_mgmt mgmt;

View file

@ -719,7 +719,7 @@ static int wpa_driver_ndis_disconnect(struct wpa_driver_ndis_data *drv)
static int wpa_driver_ndis_deauthenticate(void *priv, const u8 *addr,
int reason_code)
u16 reason_code)
{
struct wpa_driver_ndis_data *drv = priv;
return wpa_driver_ndis_disconnect(drv);

View file

@ -236,7 +236,7 @@ static int nl80211_put_mesh_config(struct nl_msg *msg,
struct wpa_driver_mesh_bss_params *params);
#endif /* CONFIG_MESH */
static int i802_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
int reason);
u16 reason);
/* Converts nl80211_chan_width to a common format */
@ -3282,7 +3282,7 @@ int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
int reason_code,
u16 reason_code,
struct nl_handle *nl_connect)
{
int ret;
@ -3304,7 +3304,7 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss,
const u8 *addr, int reason_code)
const u8 *addr, u16 reason_code)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
int ret;
@ -6550,7 +6550,7 @@ static int i802_sta_clear_stats(void *priv, const u8 *addr)
static int i802_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
int reason)
u16 reason)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
@ -6585,7 +6585,7 @@ static int i802_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
static int i802_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
int reason)
u16 reason)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
@ -8585,7 +8585,7 @@ static int driver_nl80211_scan2(void *priv,
static int driver_nl80211_deauthenticate(void *priv, const u8 *addr,
int reason_code)
u16 reason_code)
{
struct i802_bss *bss = priv;
return wpa_driver_nl80211_deauthenticate(bss, addr, reason_code);

View file

@ -368,7 +368,7 @@ static int wpa_driver_privsep_get_ssid(void *priv, u8 *ssid)
static int wpa_driver_privsep_deauthenticate(void *priv, const u8 *addr,
int reason_code)
u16 reason_code)
{
//struct wpa_driver_privsep_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s addr=" MACSTR " reason_code=%d",

View file

@ -1915,7 +1915,7 @@ static int wpa_driver_wext_set_drop_unencrypted(void *priv,
static int wpa_driver_wext_mlme(struct wpa_driver_wext_data *drv,
const u8 *addr, int cmd, int reason_code)
const u8 *addr, int cmd, u16 reason_code)
{
struct iwreq iwr;
struct iw_mlme mlme;
@ -1998,7 +1998,7 @@ static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv)
static int wpa_driver_wext_deauthenticate(void *priv, const u8 *addr,
int reason_code)
u16 reason_code)
{
struct wpa_driver_wext_data *drv = priv;
int ret;

View file

@ -26,7 +26,7 @@ struct wpa_sm_ctx {
void (*set_state)(void *ctx, enum wpa_states state);
enum wpa_states (*get_state)(void *ctx);
void (*deauthenticate)(void * ctx, int reason_code);
void (*deauthenticate)(void * ctx, u16 reason_code);
int (*set_key)(void *ctx, enum wpa_alg alg,
const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len,

View file

@ -188,7 +188,7 @@ static inline enum wpa_states wpa_sm_get_state(struct wpa_sm *sm)
return sm->ctx->get_state(sm->ctx->ctx);
}
static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, int reason_code)
static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, u16 reason_code)
{
WPA_ASSERT(sm->ctx->deauthenticate);
sm->ctx->deauthenticate(sm->ctx->ctx, reason_code);

View file

@ -72,7 +72,7 @@ static void set_state(void *arg, enum wpa_states state)
}
static void deauthenticate(void *arg, int reason_code)
static void deauthenticate(void *arg, u16 reason_code)
{
}

View file

@ -270,7 +270,7 @@ static void * supp_get_network_ctx(void *ctx)
}
static void supp_deauthenticate(void *ctx, int reason_code)
static void supp_deauthenticate(void *ctx, u16 reason_code)
{
wpa_printf(MSG_DEBUG, "SUPP: %s(%d)", __func__, reason_code);
}

View file

@ -168,7 +168,7 @@ static inline int wpa_drv_get_seqnum(struct wpa_supplicant *wpa_s,
}
static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
const u8 *addr, u16 reason_code)
{
if (wpa_s->driver->sta_deauth) {
return wpa_s->driver->sta_deauth(wpa_s->drv_priv,
@ -179,7 +179,7 @@ static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
}
static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
const u8 *addr, u16 reason_code)
{
if (wpa_s->driver->deauthenticate) {
return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,

View file

@ -193,7 +193,7 @@ static void supp_cancel_auth_timeout(void *ctx)
}
static void supp_deauthenticate(void * ctx, int reason_code)
static void supp_deauthenticate(void * ctx, u16 reason_code)
{
wpa_printf(MSG_DEBUG, "SUPP: %s (TODO)", __func__);
}

View file

@ -901,7 +901,7 @@ void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
const u8 *meshid, u8 meshid_len,
int reason_code)
u16 reason_code)
{
if (wpa_s->p2p_mgmt)
return;
@ -922,7 +922,7 @@ void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
const u8 *peer_addr, int reason_code)
const u8 *peer_addr, u16 reason_code)
{
if (wpa_s->p2p_mgmt)
return;

View file

@ -151,10 +151,10 @@ void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
const u8 *meshid, u8 meshid_len,
int reason_code);
u16 reason_code);
void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
const u8 *peer_addr);
void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
const u8 *peer_addr, int reason_code);
const u8 *peer_addr, u16 reason_code);
#endif /* NOTIFY_H */

View file

@ -35,7 +35,7 @@ struct preauth_test_data {
};
static void _wpa_supplicant_deauthenticate(void *wpa_s, int reason_code)
static void _wpa_supplicant_deauthenticate(void *wpa_s, u16 reason_code)
{
wpa_supplicant_deauthenticate(wpa_s, reason_code);
}

View file

@ -3422,7 +3422,7 @@ static void wpa_supplicant_clear_connection(struct wpa_supplicant *wpa_s,
* current AP.
*/
void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
int reason_code)
u16 reason_code)
{
u8 *addr = NULL;
union wpa_event_data event;
@ -3474,7 +3474,7 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
if (addr) {
wpa_drv_deauthenticate(wpa_s, addr, reason_code);
os_memset(&event, 0, sizeof(event));
event.deauth_info.reason_code = (u16) reason_code;
event.deauth_info.reason_code = reason_code;
event.deauth_info.locally_generated = 1;
wpa_supplicant_event(wpa_s, EVENT_DEAUTH, &event);
if (zero_addr)

View file

@ -1291,7 +1291,7 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
int reason_code);
u16 reason_code);
struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);

View file

@ -464,7 +464,7 @@ static enum wpa_states _wpa_supplicant_get_state(void *wpa_s)
}
static void _wpa_supplicant_deauthenticate(void *wpa_s, int reason_code)
static void _wpa_supplicant_deauthenticate(void *wpa_s, u16 reason_code)
{
wpa_supplicant_deauthenticate(wpa_s, reason_code);
/* Schedule a scan to make sure we continue looking for networks */