aboutsummaryrefslogtreecommitdiffstats
path: root/package/iwinfo/src/iwinfo_nl80211.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-02-23 13:16:09 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-02-23 13:16:09 +0000
commit69dd217a4a266ae746166b7fc90fb93e7cbff2d9 (patch)
tree2208fc689a08735c90768187d87c8ac18e3d2473 /package/iwinfo/src/iwinfo_nl80211.c
parent80317f56a404e4c2168faa8963c1910e65f38e48 (diff)
downloadupstream-69dd217a4a266ae746166b7fc90fb93e7cbff2d9.tar.gz
upstream-69dd217a4a266ae746166b7fc90fb93e7cbff2d9.tar.bz2
upstream-69dd217a4a266ae746166b7fc90fb93e7cbff2d9.zip
[package] iwinfo: replace internal constant mode strings with enums
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30692 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iwinfo/src/iwinfo_nl80211.c')
-rw-r--r--package/iwinfo/src/iwinfo_nl80211.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/package/iwinfo/src/iwinfo_nl80211.c b/package/iwinfo/src/iwinfo_nl80211.c
index 528615079a..bd3a60b0ac 100644
--- a/package/iwinfo/src/iwinfo_nl80211.c
+++ b/package/iwinfo/src/iwinfo_nl80211.c
@@ -700,7 +700,7 @@ void nl80211_close(void)
}
}
-int nl80211_get_mode(const char *ifname, char *buf)
+int nl80211_get_mode(const char *ifname, int *buf)
{
return wext_get_mode(ifname, buf);
}
@@ -1525,9 +1525,9 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, void *arg)
memcpy(sl->e->mac, nla_data(bss[NL80211_BSS_BSSID]), 6);
if (caps & (1<<1))
- memcpy(sl->e->mode, "Ad-Hoc", 6);
+ sl->e->mode = IWINFO_OPMODE_ADHOC;
else
- memcpy(sl->e->mode, "Master", 6);
+ sl->e->mode = IWINFO_OPMODE_MASTER;
if (caps & (1<<4))
sl->e->crypto.enabled = 1;
@@ -1568,7 +1568,6 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, void *arg)
static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
{
- struct nl_msg *ssids = NULL;
struct nl80211_msg_conveyor *req;
struct nl80211_scanlist sl = { .e = (struct iwinfo_scanlist_entry *)buf };
@@ -1590,11 +1589,6 @@ static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
*len = sl.len * sizeof(struct iwinfo_scanlist_entry);
return *len ? 0 : -1;
-
-nla_put_failure:
- if (ssids)
- nlmsg_free(ssids);
- return -1;
}
int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
@@ -1652,7 +1646,7 @@ int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
memcpy(e->ssid, ssid, min(strlen(ssid), sizeof(e->ssid) - 1));
/* Mode (assume master) */
- sprintf((char *)e->mode, "Master");
+ e->mode = IWINFO_OPMODE_MASTER;
/* Channel */
e->channel = nl80211_freq2channel(freq);
@@ -1685,7 +1679,7 @@ int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
nl80211_get_scancrypto(cipher, &e->crypto);
/* advance to next line */
- while( *res && *res++ != '\n' );
+ while (*res && *res++ != '\n');
count++;
e++;