mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-29 02:38:22 -05:00
Share same set_country driver op for hostapd and wpa_supplicant
This commit is contained in:
parent
9f324b61ba
commit
e785c2ba3b
@ -291,9 +291,9 @@ static inline int
|
|||||||
hostapd_set_country(struct hostapd_data *hapd, const char *country)
|
hostapd_set_country(struct hostapd_data *hapd, const char *country)
|
||||||
{
|
{
|
||||||
if (hapd->driver == NULL ||
|
if (hapd->driver == NULL ||
|
||||||
hapd->driver->hapd_set_country == NULL)
|
hapd->driver->set_country == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
return hapd->driver->hapd_set_country(hapd->drv_priv, country);
|
return hapd->driver->set_country(hapd->drv_priv, country);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -1263,7 +1263,6 @@ struct wpa_driver_ops {
|
|||||||
int total_flags, int flags_or, int flags_and);
|
int total_flags, int flags_or, int flags_and);
|
||||||
int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
|
int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
|
||||||
int mode);
|
int mode);
|
||||||
int (*hapd_set_country)(void *priv, const char *country);
|
|
||||||
int (*set_ieee80211d)(void *priv, int enabled);
|
int (*set_ieee80211d)(void *priv, int enabled);
|
||||||
int (*hapd_set_beacon)(const char *ifname, void *priv,
|
int (*hapd_set_beacon)(const char *ifname, void *priv,
|
||||||
const u8 *head, size_t head_len,
|
const u8 *head, size_t head_len,
|
||||||
|
@ -3242,7 +3242,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
|
|||||||
NULL /* set_retry */,
|
NULL /* set_retry */,
|
||||||
NULL /* sta_set_flags */,
|
NULL /* sta_set_flags */,
|
||||||
NULL /* set_rate_sets */,
|
NULL /* set_rate_sets */,
|
||||||
NULL /* hapd_set_country */,
|
|
||||||
NULL /* set_ieee80211d */,
|
NULL /* set_ieee80211d */,
|
||||||
NULL /* hapd_set_beacon */,
|
NULL /* hapd_set_beacon */,
|
||||||
NULL /* set_internal_bridge */,
|
NULL /* set_internal_bridge */,
|
||||||
|
@ -921,7 +921,7 @@ static int wpa_driver_nl80211_set_country(void *priv, const char *alpha2_arg)
|
|||||||
|
|
||||||
msg = nlmsg_alloc();
|
msg = nlmsg_alloc();
|
||||||
if (!msg)
|
if (!msg)
|
||||||
goto nla_put_failure;
|
return -ENOMEM;
|
||||||
|
|
||||||
alpha2[0] = alpha2_arg[0];
|
alpha2[0] = alpha2_arg[0];
|
||||||
alpha2[1] = alpha2_arg[1];
|
alpha2[1] = alpha2_arg[1];
|
||||||
@ -3815,30 +3815,6 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int i802_set_country(void *priv, const char *country)
|
|
||||||
{
|
|
||||||
struct wpa_driver_nl80211_data *drv = priv;
|
|
||||||
struct nl_msg *msg;
|
|
||||||
char alpha2[3];
|
|
||||||
|
|
||||||
msg = nlmsg_alloc();
|
|
||||||
if (!msg)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0,
|
|
||||||
0, NL80211_CMD_REQ_SET_REG, 0);
|
|
||||||
|
|
||||||
alpha2[0] = country[0];
|
|
||||||
alpha2[1] = country[1];
|
|
||||||
alpha2[2] = '\0';
|
|
||||||
NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, alpha2);
|
|
||||||
|
|
||||||
return send_and_recv_msgs(drv, msg, NULL, NULL);
|
|
||||||
nla_put_failure:
|
|
||||||
return -ENOBUFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
|
static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
|
||||||
int ok)
|
int ok)
|
||||||
{
|
{
|
||||||
@ -5064,7 +5040,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
|||||||
.if_update = i802_if_update,
|
.if_update = i802_if_update,
|
||||||
.if_remove = i802_if_remove,
|
.if_remove = i802_if_remove,
|
||||||
.set_sta_vlan = i802_set_sta_vlan,
|
.set_sta_vlan = i802_set_sta_vlan,
|
||||||
.hapd_set_country = i802_set_country,
|
|
||||||
.get_neighbor_bss = i802_get_neighbor_bss,
|
.get_neighbor_bss = i802_get_neighbor_bss,
|
||||||
#endif /* HOSTAPD */
|
#endif /* HOSTAPD */
|
||||||
};
|
};
|
||||||
|
@ -838,7 +838,6 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
|
|||||||
NULL /* set_retry */,
|
NULL /* set_retry */,
|
||||||
NULL /* sta_set_flags */,
|
NULL /* sta_set_flags */,
|
||||||
NULL /* set_rate_sets */,
|
NULL /* set_rate_sets */,
|
||||||
NULL /* hapd_set_country */,
|
|
||||||
NULL /* set_ieee80211d */,
|
NULL /* set_ieee80211d */,
|
||||||
NULL /* hapd_set_beacon */,
|
NULL /* hapd_set_beacon */,
|
||||||
NULL /* set_internal_bridge */,
|
NULL /* set_internal_bridge */,
|
||||||
|
@ -2546,7 +2546,6 @@ const struct wpa_driver_ops wpa_driver_test_ops = {
|
|||||||
NULL /* set_retry */,
|
NULL /* set_retry */,
|
||||||
NULL /* sta_set_flags */,
|
NULL /* sta_set_flags */,
|
||||||
NULL /* set_rate_sets */,
|
NULL /* set_rate_sets */,
|
||||||
NULL /* hapd_set_country */,
|
|
||||||
NULL /* set_ieee80211d */,
|
NULL /* set_ieee80211d */,
|
||||||
NULL /* hapd_set_beacon */,
|
NULL /* hapd_set_beacon */,
|
||||||
NULL /* set_internal_bridge */,
|
NULL /* set_internal_bridge */,
|
||||||
|
Loading…
Reference in New Issue
Block a user