-rw-r--r-- | libopie2/opienet/onetwork.cpp | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 21fa390..cd36f16 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -379,8 +379,10 @@ void OWirelessNetworkInterface::init() // IEEE802.11(b) radio frequency channels - //FIXME: get these directly from the interface - //FIXME: check if these channels are off-by-one iwrangestruct range; + //ML: work around an ugly HostAP bug, which needs + //ML: extra space or will complain with "invalid argument length"... :-( + char __extraBufferForBuggyDrivers[sizeof range]; _iwr.u.data.pointer = (char*) ⦥ - _iwr.u.data.length = sizeof( iwrangestruct ); + _iwr.u.data.length = (sizeof range) * 2; + _iwr.u.data.flags = 0; if ( !wioctl( SIOCGIWRANGE ) ) @@ -723,11 +725,26 @@ void OHostAPMonitoringInterface::setEnabled( bool b ) - #if WIRELESS_EXT > 14 - _if->_iwr.u.mode = IW_MODE_MONITOR; - _if->wioctl( SIOCSIWMODE ); - #else - int* args = (int*) &_if->_iwr.u.name; - args[0] = 2; - args[1] = 0; - _if->wioctl( SIOCDEVPRIVATE ); - #endif + if ( b ) + { + #if WIRELESS_EXT > 14 + _if->_iwr.u.mode = IW_MODE_MONITOR; + _if->wioctl( SIOCSIWMODE ); + #else + int* args = (int*) &_if->_iwr.u.name; + args[0] = 2; + args[1] = 0; + _if->wioctl( SIOCDEVPRIVATE ); + #endif + } + else + { + #if WIRELESS_EXT > 14 + _if->_iwr.u.mode = IW_MODE_INFRA; + _if->wioctl( SIOCSIWMODE ); + #else + int* args = (int*) &_if->_iwr.u.name; + args[0] = 0; + args[1] = 0; + _if->wioctl( SIOCDEVPRIVATE ); + #endif + } |