--- src/airodump-ng.c.old 2007-03-11 19:09:04.000000000 +0100 +++ src/airodump-ng.c 2007-03-11 19:34:21.000000000 +0100 @@ -2387,6 +2387,7 @@ char s[32]; int pid, status, channel; struct iwreq wrq; + struct ifreq ifr; channel = (G.channel[0] == 0 ) ? 10 : G.channel[0]; @@ -2430,6 +2431,22 @@ return( 1 ); } + /* FIXME we should detect mac80211 before*/ + memset( &ifr, 0, sizeof( struct ifreq ) ); + strncpy( ifr.ifr_name, interface, IFNAMSIZ ); + if( ioctl(fd_raw, SIOCGIFFLAGS, &ifr) < 0 ) + { + perror( "ioctl(SIOCGIFFLAGS) failed" ); + return( 1 ); + } + ifr.ifr_flags &= ~IFF_UP; + ifr.ifr_flags &= ~IFF_RUNNING; + if( ioctl(fd_raw, SIOCSIFFLAGS, &ifr) < 0 ) + { + perror( "ioctl(SIOCSIFFLAGS) failed" ); + return( 1 ); + } + memset( &wrq, 0, sizeof( struct iwreq ) ); strncpy( wrq.ifr_name, interface, IFNAMSIZ ); wrq.u.mode = IW_MODE_MONITOR; @@ -2440,6 +2457,22 @@ return( 1 ); } + /* FIXME we should detect mac80211 before*/ + memset( &ifr, 0, sizeof( struct ifreq ) ); + strncpy( ifr.ifr_name, interface, IFNAMSIZ ); + if( ioctl(fd_raw, SIOCGIFFLAGS, &ifr) < 0 ) + { + perror( "ioctl(SIOCGIFFLAGS) failed" ); + return( 1 ); + } + ifr.ifr_flags |= IFF_UP; + ifr.ifr_flags |= IFF_RUNNING; + if( ioctl(fd_raw, SIOCSIFFLAGS, &ifr) < 0 ) + { + perror( "ioctl(SIOCSIFFLAGS) failed" ); + return( 1 ); + } + } /* Check later if it's really usefull to set channel here */