aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2008-11-25 12:10:35 +0200
committerJouni Malinen <j@w1.fi>2008-11-25 12:10:35 +0200
commitd6c9d4740bb2058f816317a385f90d078e7830c6 (patch)
tree56d74be6c4cbfd722b11d2f9721967f4e0eaf413 /hostapd
parentdf73d284fbe60721ddedf565f53dae543348e306 (diff)
downloadexternal_wpa_supplicant_8_ti-d6c9d4740bb2058f816317a385f90d078e7830c6.zip
external_wpa_supplicant_8_ti-d6c9d4740bb2058f816317a385f90d078e7830c6.tar.gz
external_wpa_supplicant_8_ti-d6c9d4740bb2058f816317a385f90d078e7830c6.tar.bz2
driver_nl80211: Added set_country() handler
If country_code is set in hostapd.conf, hostapd will now update nl80211 regulatory data by setting the alpha2 string for CRDA. In other words, "iw reg set <alpha2>" is not needed anymore when using hostapd.
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/driver_nl80211.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hostapd/driver_nl80211.c b/hostapd/driver_nl80211.c
index bcbbcd7..3fcb4dd 100644
--- a/hostapd/driver_nl80211.c
+++ b/hostapd/driver_nl80211.c
@@ -1510,6 +1510,30 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
}
+static int i802_set_country(void *priv, const char *country)
+{
+ struct i802_driver_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_unknown_sta(struct hostapd_data *hapd, u8 *ta)
{
struct sta_info *sta;
@@ -2402,4 +2426,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.if_remove = i802_if_remove,
.get_hw_feature_data = i802_get_hw_feature_data,
.set_sta_vlan = i802_set_sta_vlan,
+ .set_country = i802_set_country,
};