aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-07-25 15:52:17 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-07-25 15:52:17 +0000
commitbabd1e2b82ecc206571590830b127caa1fae3987 (patch)
treefbab17f225c771071a199704dcb6d72986461142 /package
parent520854d0e92bc90ef7b38b104c725a2b610c0e65 (diff)
downloadupstream-babd1e2b82ecc206571590830b127caa1fae3987.tar.gz
upstream-babd1e2b82ecc206571590830b127caa1fae3987.tar.bz2
upstream-babd1e2b82ecc206571590830b127caa1fae3987.zip
iwinfo: avoid creating tmp.* ifaces for scanning
If the iface to scan on already is in ad-hoc, station or monitor mode then do not spawn a temporary iface. Also preventively disable IPv6 on temporary ifaces before bringing them up to avoid potential security issues. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41830 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_nl80211.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
index c8b167b32a..5550e92f2f 100644
--- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c
+++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
@@ -720,9 +720,10 @@ out:
static char * nl80211_ifadd(const char *ifname)
{
int phyidx;
- char *rv = NULL;
+ char *rv = NULL, path[PATH_MAX];
static char nif[IFNAMSIZ] = { 0 };
struct nl80211_msg_conveyor *req, *res;
+ FILE *sysfs;
req = nl80211_msg(ifname, NL80211_CMD_NEW_INTERFACE, 0);
if (req)
@@ -734,6 +735,15 @@ static char * nl80211_ifadd(const char *ifname)
nl80211_send(req, NULL, NULL);
+ snprintf(path, sizeof(path) - 1,
+ "/proc/sys/net/ipv6/conf/%s/disable_ipv6", nif);
+
+ if ((sysfs = fopen(path, "w")) != NULL)
+ {
+ fwrite("0\n", 1, 2, sysfs);
+ fclose(sysfs);
+ }
+
rv = nif;
nla_put_failure:
@@ -1865,7 +1875,7 @@ static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
{
- int freq, rssi, qmax, count;
+ int freq, rssi, qmax, count, mode;
char *res;
char ssid[128] = { 0 };
char bssid[18] = { 0 };
@@ -1983,6 +1993,16 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
}
}
+ /* station / ad-hoc / monitor scan */
+ else if (!nl80211_get_mode(ifname, &mode) &&
+ (mode == IWINFO_OPMODE_ADHOC ||
+ mode == IWINFO_OPMODE_CLIENT ||
+ mode == IWINFO_OPMODE_MONITOR) &&
+ iwinfo_ifup(ifname))
+ {
+ return nl80211_get_scanlist_nl(ifname, buf, len);
+ }
+
/* AP scan */
else
{