projects
/
openwrt
/
svn-archive
/
archive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9b31e5b
)
[package] iwinfo: replace internal constant mode strings with enums
author
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 23 Feb 2012 13:16:09 +0000
(13:16 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 23 Feb 2012 13:16:09 +0000
(13:16 +0000)
SVN-Revision: 30692
13 files changed:
package/iwinfo/src/include/iwinfo.h
patch
|
blob
|
history
package/iwinfo/src/include/iwinfo/madwifi.h
patch
|
blob
|
history
package/iwinfo/src/include/iwinfo/nl80211.h
patch
|
blob
|
history
package/iwinfo/src/include/iwinfo/wext.h
patch
|
blob
|
history
package/iwinfo/src/include/iwinfo/wl.h
patch
|
blob
|
history
package/iwinfo/src/iwinfo_cli.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_lib.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_lua.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_madwifi.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_nl80211.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_wext.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_wext_scan.c
patch
|
blob
|
history
package/iwinfo/src/iwinfo_wl.c
patch
|
blob
|
history
diff --git
a/package/iwinfo/src/include/iwinfo.h
b/package/iwinfo/src/include/iwinfo.h
index 72e23336174d46898f3a131ab345c19f5cdbd591..3c8b4188312fce94a7abd55952f1e75402614b76 100644
(file)
--- a/
package/iwinfo/src/include/iwinfo.h
+++ b/
package/iwinfo/src/include/iwinfo.h
@@
-49,6
+49,17
@@
extern const char *IWINFO_KMGMT_NAMES[];
extern const char *IWINFO_AUTH_NAMES[];
extern const char *IWINFO_AUTH_NAMES[];
+enum iwinfo_opmode {
+ IWINFO_OPMODE_UNKNOWN = 0,
+ IWINFO_OPMODE_MASTER = 1,
+ IWINFO_OPMODE_ADHOC = 2,
+ IWINFO_OPMODE_CLIENT = 3,
+ IWINFO_OPMODE_MONITOR = 4,
+};
+
+extern const char *IWINFO_OPMODE_NAMES[];
+
+
struct iwinfo_rate_entry {
uint16_t rate;
uint8_t mcs;
struct iwinfo_rate_entry {
uint16_t rate;
uint8_t mcs;
@@
-90,7
+101,7
@@
struct iwinfo_crypto_entry {
struct iwinfo_scanlist_entry {
uint8_t mac[6];
uint8_t ssid[IWINFO_ESSID_MAX_SIZE+1];
struct iwinfo_scanlist_entry {
uint8_t mac[6];
uint8_t ssid[IWINFO_ESSID_MAX_SIZE+1];
-
uint8_t mode[8]
;
+
enum iwinfo_opmode mode
;
uint8_t channel;
uint8_t signal;
uint8_t quality;
uint8_t channel;
uint8_t signal;
uint8_t quality;
@@
-131,6
+142,7
@@
extern const struct iwinfo_hardware_entry IWINFO_HARDWARE_ENTRIES[];
struct iwinfo_ops {
struct iwinfo_ops {
+ int (*mode)(const char *, int *);
int (*channel)(const char *, int *);
int (*frequency)(const char *, int *);
int (*frequency_offset)(const char *, int *);
int (*channel)(const char *, int *);
int (*frequency)(const char *, int *);
int (*frequency_offset)(const char *, int *);
@@
-143,7
+155,6
@@
struct iwinfo_ops {
int (*quality_max)(const char *, int *);
int (*mbssid_support)(const char *, int *);
int (*hwmodelist)(const char *, int *);
int (*quality_max)(const char *, int *);
int (*mbssid_support)(const char *, int *);
int (*hwmodelist)(const char *, int *);
- int (*mode)(const char *, char *);
int (*ssid)(const char *, char *);
int (*bssid)(const char *, char *);
int (*country)(const char *, char *);
int (*ssid)(const char *, char *);
int (*bssid)(const char *, char *);
int (*country)(const char *, char *);
diff --git
a/package/iwinfo/src/include/iwinfo/madwifi.h
b/package/iwinfo/src/include/iwinfo/madwifi.h
index 9acbc36460ed224b883a0b7d85395fb668031373..14d81352b79748d21eb70a1d22aa833129c941eb 100644
(file)
--- a/
package/iwinfo/src/include/iwinfo/madwifi.h
+++ b/
package/iwinfo/src/include/iwinfo/madwifi.h
@@
-26,7
+26,7
@@
#include "iwinfo/api/madwifi.h"
int madwifi_probe(const char *ifname);
#include "iwinfo/api/madwifi.h"
int madwifi_probe(const char *ifname);
-int madwifi_get_mode(const char *ifname,
char
*buf);
+int madwifi_get_mode(const char *ifname,
int
*buf);
int madwifi_get_ssid(const char *ifname, char *buf);
int madwifi_get_bssid(const char *ifname, char *buf);
int madwifi_get_country(const char *ifname, char *buf);
int madwifi_get_ssid(const char *ifname, char *buf);
int madwifi_get_bssid(const char *ifname, char *buf);
int madwifi_get_country(const char *ifname, char *buf);
diff --git
a/package/iwinfo/src/include/iwinfo/nl80211.h
b/package/iwinfo/src/include/iwinfo/nl80211.h
index 7bbf0ef7bfbc55034efedc22a567ee6b6cb3ffba..28545141d0e0bbc73fb86ea21abe41308b7deeb5 100644
(file)
--- a/
package/iwinfo/src/include/iwinfo/nl80211.h
+++ b/
package/iwinfo/src/include/iwinfo/nl80211.h
@@
-68,7
+68,7
@@
struct nl80211_array_buf {
};
int nl80211_probe(const char *ifname);
};
int nl80211_probe(const char *ifname);
-int nl80211_get_mode(const char *ifname,
char
*buf);
+int nl80211_get_mode(const char *ifname,
int
*buf);
int nl80211_get_ssid(const char *ifname, char *buf);
int nl80211_get_bssid(const char *ifname, char *buf);
int nl80211_get_country(const char *ifname, char *buf);
int nl80211_get_ssid(const char *ifname, char *buf);
int nl80211_get_bssid(const char *ifname, char *buf);
int nl80211_get_country(const char *ifname, char *buf);
diff --git
a/package/iwinfo/src/include/iwinfo/wext.h
b/package/iwinfo/src/include/iwinfo/wext.h
index 8412ef39b3474921335bf49ca2dcca298c6b95bf..68b596ea8bd9ee03d0eff0e75eed2e08a36e6a15 100644
(file)
--- a/
package/iwinfo/src/include/iwinfo/wext.h
+++ b/
package/iwinfo/src/include/iwinfo/wext.h
@@
-27,7
+27,7
@@
int wext_probe(const char *ifname);
int wext_probe(const char *ifname);
-int wext_get_mode(const char *ifname,
char
*buf);
+int wext_get_mode(const char *ifname,
int
*buf);
int wext_get_ssid(const char *ifname, char *buf);
int wext_get_bssid(const char *ifname, char *buf);
int wext_get_country(const char *ifname, char *buf);
int wext_get_ssid(const char *ifname, char *buf);
int wext_get_bssid(const char *ifname, char *buf);
int wext_get_country(const char *ifname, char *buf);
diff --git
a/package/iwinfo/src/include/iwinfo/wl.h
b/package/iwinfo/src/include/iwinfo/wl.h
index 47dda47102ca0cb1fd8e101948ff794fa549f696..db37e3759d96df24fb788437cb51944b7b0c5e91 100644
(file)
--- a/
package/iwinfo/src/include/iwinfo/wl.h
+++ b/
package/iwinfo/src/include/iwinfo/wl.h
@@
-26,7
+26,7
@@
#include "iwinfo/api/broadcom.h"
int wl_probe(const char *ifname);
#include "iwinfo/api/broadcom.h"
int wl_probe(const char *ifname);
-int wl_get_mode(const char *ifname,
char
*buf);
+int wl_get_mode(const char *ifname,
int
*buf);
int wl_get_ssid(const char *ifname, char *buf);
int wl_get_bssid(const char *ifname, char *buf);
int wl_get_country(const char *ifname, char *buf);
int wl_get_ssid(const char *ifname, char *buf);
int wl_get_bssid(const char *ifname, char *buf);
int wl_get_country(const char *ifname, char *buf);
diff --git
a/package/iwinfo/src/iwinfo_cli.c
b/package/iwinfo/src/iwinfo_cli.c
index 186cce1433e17a9adfb994ab1931d05017717e4f..0fdb21ec677c2f6977597b9962db620ef7ac0ec8 100644
(file)
--- a/
package/iwinfo/src/iwinfo_cli.c
+++ b/
package/iwinfo/src/iwinfo_cli.c
@@
-391,10
+391,13
@@
static char * print_bssid(const struct iwinfo_ops *iw, const char *ifname)
static char * print_mode(const struct iwinfo_ops *iw, const char *ifname)
{
static char * print_mode(const struct iwinfo_ops *iw, const char *ifname)
{
+ int mode;
static char buf[128];
static char buf[128];
- if (iw->mode(ifname, buf))
- snprintf(buf, sizeof(buf), "unknown");
+ if (iw->mode(ifname, &mode))
+ mode = IWINFO_OPMODE_UNKNOWN;
+
+ snprintf(buf, sizeof(buf), "%s", IWINFO_OPMODE_NAMES[mode]);
return buf;
}
return buf;
}
@@
-572,7
+575,7
@@
static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
printf(" ESSID: %s\n",
format_ssid(e->ssid));
printf(" Mode: %s Channel: %s\n",
printf(" ESSID: %s\n",
format_ssid(e->ssid));
printf(" Mode: %s Channel: %s\n",
-
e->mode ? (char *)e->mode : "unknown"
,
+
IWINFO_OPMODE_NAMES[e->mode]
,
format_channel(e->channel));
printf(" Signal: %s Quality: %s/%s\n",
format_signal(e->signal - 0x100),
format_channel(e->channel));
printf(" Signal: %s Quality: %s/%s\n",
format_signal(e->signal - 0x100),
diff --git
a/package/iwinfo/src/iwinfo_lib.c
b/package/iwinfo/src/iwinfo_lib.c
index a28d985533ad06b953c145dd70b8831a4b266177..98bd1ec0d582e63263500d6a49733aaead04d054 100644
(file)
--- a/
package/iwinfo/src/iwinfo_lib.c
+++ b/
package/iwinfo/src/iwinfo_lib.c
@@
-44,6
+44,14
@@
const char *IWINFO_AUTH_NAMES[] = {
"SHARED",
};
"SHARED",
};
+const char *IWINFO_OPMODE_NAMES[] = {
+ "Unknown",
+ "Master",
+ "Ad-Hoc",
+ "Client",
+ "Monitor",
+};
+
/*
* ISO3166 country labels
/*
* ISO3166 country labels
diff --git
a/package/iwinfo/src/iwinfo_lua.c
b/package/iwinfo/src/iwinfo_lua.c
index 6b78cb763c0bfe4574dd023aefa611c690505628..e4435c1ff086f851b5497c7293aaaf6c7554c6d0 100644
(file)
--- a/
package/iwinfo/src/iwinfo_lua.c
+++ b/
package/iwinfo/src/iwinfo_lua.c
@@
-235,6
+235,19
@@
static void iwinfo_L_cryptotable(lua_State *L, struct iwinfo_crypto_entry *c)
}
}
+/* Wrapper for mode */
+static int iwinfo_L_mode(lua_State *L, int (*func)(const char *, int *))
+{
+ int mode;
+ const char *ifname = luaL_checkstring(L, 1);
+
+ if ((*func)(ifname, &mode))
+ mode = IWINFO_OPMODE_UNKNOWN;
+
+ lua_pushstring(L, IWINFO_OPMODE_NAMES[mode]);
+ return 1;
+}
+
/* Wrapper for assoclist */
static int iwinfo_L_assoclist(lua_State *L, int (*func)(const char *, char *, int *))
{
/* Wrapper for assoclist */
static int iwinfo_L_assoclist(lua_State *L, int (*func)(const char *, char *, int *))
{
@@
-383,7
+396,7
@@
static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int
lua_setfield(L, -2, "channel");
/* Mode */
lua_setfield(L, -2, "channel");
/* Mode */
- lua_pushstring(L,
(char *) e->mode
);
+ lua_pushstring(L,
IWINFO_OPMODE_NAMES[e->mode]
);
lua_setfield(L, -2, "mode");
/* Quality, Signal */
lua_setfield(L, -2, "mode");
/* Quality, Signal */
@@
-605,11
+618,11
@@
LUA_WRAP_INT(wl,signal)
LUA_WRAP_INT(wl,noise)
LUA_WRAP_INT(wl,quality)
LUA_WRAP_INT(wl,quality_max)
LUA_WRAP_INT(wl,noise)
LUA_WRAP_INT(wl,quality)
LUA_WRAP_INT(wl,quality_max)
-LUA_WRAP_STRING(wl,mode)
LUA_WRAP_STRING(wl,ssid)
LUA_WRAP_STRING(wl,bssid)
LUA_WRAP_STRING(wl,country)
LUA_WRAP_STRING(wl,hardware_name)
LUA_WRAP_STRING(wl,ssid)
LUA_WRAP_STRING(wl,bssid)
LUA_WRAP_STRING(wl,country)
LUA_WRAP_STRING(wl,hardware_name)
+LUA_WRAP_STRUCT(wl,mode)
LUA_WRAP_STRUCT(wl,assoclist)
LUA_WRAP_STRUCT(wl,txpwrlist)
LUA_WRAP_STRUCT(wl,scanlist)
LUA_WRAP_STRUCT(wl,assoclist)
LUA_WRAP_STRUCT(wl,txpwrlist)
LUA_WRAP_STRUCT(wl,scanlist)
@@
-633,11
+646,11
@@
LUA_WRAP_INT(madwifi,signal)
LUA_WRAP_INT(madwifi,noise)
LUA_WRAP_INT(madwifi,quality)
LUA_WRAP_INT(madwifi,quality_max)
LUA_WRAP_INT(madwifi,noise)
LUA_WRAP_INT(madwifi,quality)
LUA_WRAP_INT(madwifi,quality_max)
-LUA_WRAP_STRING(madwifi,mode)
LUA_WRAP_STRING(madwifi,ssid)
LUA_WRAP_STRING(madwifi,bssid)
LUA_WRAP_STRING(madwifi,country)
LUA_WRAP_STRING(madwifi,hardware_name)
LUA_WRAP_STRING(madwifi,ssid)
LUA_WRAP_STRING(madwifi,bssid)
LUA_WRAP_STRING(madwifi,country)
LUA_WRAP_STRING(madwifi,hardware_name)
+LUA_WRAP_STRUCT(madwifi,mode)
LUA_WRAP_STRUCT(madwifi,assoclist)
LUA_WRAP_STRUCT(madwifi,txpwrlist)
LUA_WRAP_STRUCT(madwifi,scanlist)
LUA_WRAP_STRUCT(madwifi,assoclist)
LUA_WRAP_STRUCT(madwifi,txpwrlist)
LUA_WRAP_STRUCT(madwifi,scanlist)
@@
-661,11
+674,11
@@
LUA_WRAP_INT(nl80211,signal)
LUA_WRAP_INT(nl80211,noise)
LUA_WRAP_INT(nl80211,quality)
LUA_WRAP_INT(nl80211,quality_max)
LUA_WRAP_INT(nl80211,noise)
LUA_WRAP_INT(nl80211,quality)
LUA_WRAP_INT(nl80211,quality_max)
-LUA_WRAP_STRING(nl80211,mode)
LUA_WRAP_STRING(nl80211,ssid)
LUA_WRAP_STRING(nl80211,bssid)
LUA_WRAP_STRING(nl80211,country)
LUA_WRAP_STRING(nl80211,hardware_name)
LUA_WRAP_STRING(nl80211,ssid)
LUA_WRAP_STRING(nl80211,bssid)
LUA_WRAP_STRING(nl80211,country)
LUA_WRAP_STRING(nl80211,hardware_name)
+LUA_WRAP_STRUCT(nl80211,mode)
LUA_WRAP_STRUCT(nl80211,assoclist)
LUA_WRAP_STRUCT(nl80211,txpwrlist)
LUA_WRAP_STRUCT(nl80211,scanlist)
LUA_WRAP_STRUCT(nl80211,assoclist)
LUA_WRAP_STRUCT(nl80211,txpwrlist)
LUA_WRAP_STRUCT(nl80211,scanlist)
@@
-688,11
+701,11
@@
LUA_WRAP_INT(wext,signal)
LUA_WRAP_INT(wext,noise)
LUA_WRAP_INT(wext,quality)
LUA_WRAP_INT(wext,quality_max)
LUA_WRAP_INT(wext,noise)
LUA_WRAP_INT(wext,quality)
LUA_WRAP_INT(wext,quality_max)
-LUA_WRAP_STRING(wext,mode)
LUA_WRAP_STRING(wext,ssid)
LUA_WRAP_STRING(wext,bssid)
LUA_WRAP_STRING(wext,country)
LUA_WRAP_STRING(wext,hardware_name)
LUA_WRAP_STRING(wext,ssid)
LUA_WRAP_STRING(wext,bssid)
LUA_WRAP_STRING(wext,country)
LUA_WRAP_STRING(wext,hardware_name)
+LUA_WRAP_STRUCT(wext,mode)
LUA_WRAP_STRUCT(wext,assoclist)
LUA_WRAP_STRUCT(wext,txpwrlist)
LUA_WRAP_STRUCT(wext,scanlist)
LUA_WRAP_STRUCT(wext,assoclist)
LUA_WRAP_STRUCT(wext,txpwrlist)
LUA_WRAP_STRUCT(wext,scanlist)
diff --git
a/package/iwinfo/src/iwinfo_madwifi.c
b/package/iwinfo/src/iwinfo_madwifi.c
index 043cf53e83e5a0a0ff9c35b24cc988b33b8d8d4f..50efcbfd40f519343323d7766052930bbc7f10b5 100644
(file)
--- a/
package/iwinfo/src/iwinfo_madwifi.c
+++ b/
package/iwinfo/src/iwinfo_madwifi.c
@@
-333,7
+333,7
@@
void madwifi_close(void)
/* Nop */
}
/* Nop */
}
-int madwifi_get_mode(const char *ifname,
char
*buf)
+int madwifi_get_mode(const char *ifname,
int
*buf)
{
return wext_get_mode(ifname, buf);
}
{
return wext_get_mode(ifname, buf);
}
diff --git
a/package/iwinfo/src/iwinfo_nl80211.c
b/package/iwinfo/src/iwinfo_nl80211.c
index 528615079a4b5f0730968d872ecf9beb9e22eef3..bd3a60b0ac3460018de2c601d6f52eb2f4fe97cb 100644
(file)
--- 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);
}
{
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->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
else
-
memcpy(sl->e->mode, "Master", 6)
;
+
sl->e->mode = IWINFO_OPMODE_MASTER
;
if (caps & (1<<4))
sl->e->crypto.enabled = 1;
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)
{
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 };
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;
*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)
}
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) */
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);
/* 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 */
nl80211_get_scancrypto(cipher, &e->crypto);
/* advance to next line */
- while
( *res && *res++ != '\n'
);
+ while
(*res && *res++ != '\n'
);
count++;
e++;
count++;
e++;
diff --git
a/package/iwinfo/src/iwinfo_wext.c
b/package/iwinfo/src/iwinfo_wext.c
index c74785f874875593d2d48b9b87d1378043843b3f..cf3dccc189ae5d85b84a911ae4ecf43a80d551b5 100644
(file)
--- a/
package/iwinfo/src/iwinfo_wext.c
+++ b/
package/iwinfo/src/iwinfo_wext.c
@@
-70,7
+70,7
@@
void wext_close(void)
/* Nop */
}
/* Nop */
}
-int wext_get_mode(const char *ifname,
char
*buf)
+int wext_get_mode(const char *ifname,
int
*buf)
{
struct iwreq wrq;
{
struct iwreq wrq;
@@
-78,36
+78,25
@@
int wext_get_mode(const char *ifname, char *buf)
{
switch(wrq.u.mode)
{
{
switch(wrq.u.mode)
{
- case 0:
- sprintf(buf, "Auto");
- break;
-
case 1:
case 1:
-
sprintf(buf, "Ad-Hoc")
;
+
*buf = IWINFO_OPMODE_ADHOC
;
break;
case 2:
break;
case 2:
-
sprintf(buf, "Client")
;
+
*buf = IWINFO_OPMODE_CLIENT
;
break;
case 3:
break;
case 3:
- sprintf(buf, "Master");
- break;
-
- case 4:
- sprintf(buf, "Repeater");
- break;
-
- case 5:
- sprintf(buf, "Secondary");
+ *buf = IWINFO_OPMODE_MASTER;
break;
case 6:
break;
case 6:
-
sprintf(buf, "Monitor")
;
+
*buf = IWINFO_OPMODE_MONITOR
;
break;
default:
break;
default:
- sprintf(buf, "Unknown");
+ *buf = IWINFO_OPMODE_UNKNOWN;
+ break;
}
return 0;
}
return 0;
diff --git
a/package/iwinfo/src/iwinfo_wext_scan.c
b/package/iwinfo/src/iwinfo_wext_scan.c
index 0a0093305e970f5a0d502f23c15eccfe468df800..ecd40d71e21b4df4101a509080795741db91bf08 100644
(file)
--- a/
package/iwinfo/src/iwinfo_wext_scan.c
+++ b/
package/iwinfo/src/iwinfo_wext_scan.c
@@
-277,16
+277,17
@@
static inline void wext_fill_entry(struct stream_descr *stream, struct iw_event
switch(event->u.mode)
{
case 1:
switch(event->u.mode)
{
case 1:
-
sprintf((char *) e->mode, "Ad-Hoc")
;
+
e->mode = IWINFO_OPMODE_ADHOC
;
break;
case 2:
case 3:
break;
case 2:
case 3:
-
sprintf((char *) e->mode, "Master")
;
+
e->mode = IWINFO_OPMODE_MASTER
;
break;
default:
break;
default:
- sprintf((char *) e->mode, "Unknown");
+ e->mode = IWINFO_OPMODE_UNKNOWN;
+ break;
}
break;
}
break;
diff --git
a/package/iwinfo/src/iwinfo_wl.c
b/package/iwinfo/src/iwinfo_wl.c
index 038361f3e8338769acb97ce63fbbc0ef14c7bcf9..b7e5d19786f89f8a81e9b2f59a1d79f7d6c4602d 100644
(file)
--- a/
package/iwinfo/src/iwinfo_wl.c
+++ b/
package/iwinfo/src/iwinfo_wl.c
@@
-82,7
+82,7
@@
void wl_close(void)
/* Nop */
}
/* Nop */
}
-int wl_get_mode(const char *ifname,
char
*buf)
+int wl_get_mode(const char *ifname,
int
*buf)
{
int ret = -1;
int ap, infra, passive;
{
int ret = -1;
int ap, infra, passive;
@@
-97,13
+97,13
@@
int wl_get_mode(const char *ifname, char *buf)
return ret;
if (passive)
return ret;
if (passive)
-
sprintf(buf, "Monitor")
;
+
*buf = IWINFO_OPMODE_MONITOR
;
else if (!infra)
else if (!infra)
-
sprintf(buf, "Ad-Hoc")
;
+
*buf = IWINFO_OPMODE_ADHOC
;
else if (ap)
else if (ap)
-
sprintf(buf, "Master")
;
+
*buf = IWINFO_OPMODE_MASTER
;
else
else
-
sprintf(buf, "Client")
;
+
*buf = IWINFO_OPMODE_CLIENT
;
return 0;
}
return 0;
}