nl82011: Make wiphy-specific country (alpha2) available in STATUS-DRIVER

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2018-12-31 16:41:24 +02:00
parent 02d53ac351
commit fea49f8f93

View file

@ -8688,6 +8688,8 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen)
struct wpa_driver_nl80211_data *drv = bss->drv;
int res;
char *pos, *end;
struct nl_msg *msg;
char alpha2[3] = { 0, 0, 0 };
pos = buf;
end = buf + buflen;
@ -8832,6 +8834,23 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen)
pos += res;
}
msg = nlmsg_alloc();
if (msg &&
nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG) &&
nla_put_u32(msg, NL80211_ATTR_WIPHY, drv->wiphy_idx) == 0) {
if (send_and_recv_msgs(drv, msg, nl80211_get_country,
alpha2) == 0 &&
alpha2[0]) {
res = os_snprintf(pos, end - pos, "country=%s\n",
alpha2);
if (os_snprintf_error(end - pos, res))
return pos - buf;
pos += res;
}
} else {
nlmsg_free(msg);
}
return pos - buf;
}