Changeset 41830


Ignore:
Timestamp:
2014-07-25T17:52:17+02:00 (4 years ago)
Author:
jow
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/network/utils/iwinfo/src/iwinfo_nl80211.c

    r41826 r41830  
    721721{ 
    722722        int phyidx; 
    723         char *rv = NULL; 
     723        char *rv = NULL, path[PATH_MAX]; 
    724724        static char nif[IFNAMSIZ] = { 0 }; 
    725725        struct nl80211_msg_conveyor *req, *res; 
     726        FILE *sysfs; 
    726727 
    727728        req = nl80211_msg(ifname, NL80211_CMD_NEW_INTERFACE, 0); 
     
    734735 
    735736                nl80211_send(req, NULL, NULL); 
     737 
     738                snprintf(path, sizeof(path) - 1, 
     739                         "/proc/sys/net/ipv6/conf/%s/disable_ipv6", nif); 
     740 
     741                if ((sysfs = fopen(path, "w")) != NULL) 
     742                { 
     743                        fwrite("0\n", 1, 2, sysfs); 
     744                        fclose(sysfs); 
     745                } 
    736746 
    737747                rv = nif; 
     
    18661876static int nl80211_get_scanlist(const char *ifname, char *buf, int *len) 
    18671877{ 
    1868         int freq, rssi, qmax, count; 
     1878        int freq, rssi, qmax, count, mode; 
    18691879        char *res; 
    18701880        char ssid[128] = { 0 }; 
     
    19821992                        return 0; 
    19831993                } 
     1994        } 
     1995 
     1996        /* station / ad-hoc / monitor scan */ 
     1997        else if (!nl80211_get_mode(ifname, &mode) && 
     1998                 (mode == IWINFO_OPMODE_ADHOC || 
     1999                  mode == IWINFO_OPMODE_CLIENT || 
     2000                  mode == IWINFO_OPMODE_MONITOR) && 
     2001                 iwinfo_ifup(ifname)) 
     2002        { 
     2003                return nl80211_get_scanlist_nl(ifname, buf, len); 
    19842004        } 
    19852005 
Note: See TracChangeset for help on using the changeset viewer.