Add 'get country' command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt 2011-04-19 16:42:47 -07:00 committed by Jouni Malinen
parent 9a6ade33d4
commit 6ce937b8cf

View file

@ -142,20 +142,24 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
static int wpa_supplicant_ctrl_iface_get(struct wpa_supplicant *wpa_s, static int wpa_supplicant_ctrl_iface_get(struct wpa_supplicant *wpa_s,
char *cmd, char *buf, size_t buflen) char *cmd, char *buf, size_t buflen)
{ {
int res; int res = -1;
wpa_printf(MSG_DEBUG, "CTRL_IFACE GET '%s'", cmd); wpa_printf(MSG_DEBUG, "CTRL_IFACE GET '%s'", cmd);
if (os_strcmp(cmd, "version") == 0) { if (os_strcmp(cmd, "version") == 0) {
res = os_snprintf(buf, buflen, "%s", VERSION_STR); res = os_snprintf(buf, buflen, "%s", VERSION_STR);
} else if (os_strcasecmp(cmd, "country") == 0) {
if (wpa_s->conf->country[0] && wpa_s->conf->country[1])
res = os_snprintf(buf, buflen, "%c%c",
wpa_s->conf->country[0],
wpa_s->conf->country[1]);
}
if (res < 0 || (unsigned int) res >= buflen) if (res < 0 || (unsigned int) res >= buflen)
return -1; return -1;
return res; return res;
} }
return -1;
}
#ifdef IEEE8021X_EAPOL #ifdef IEEE8021X_EAPOL
static int wpa_supplicant_ctrl_iface_preauth(struct wpa_supplicant *wpa_s, static int wpa_supplicant_ctrl_iface_preauth(struct wpa_supplicant *wpa_s,