author | mickeyl <mickeyl> | 2003-10-09 16:01:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-09 16:01:08 (UTC) |
commit | 802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f (patch) (side-by-side diff) | |
tree | c6a33ab027752ca04d0d98a2e71a238aa954978d /libopie2 | |
parent | c5c5c9f9fc6cab574f35f8be21076ac81f8c0369 (diff) | |
download | opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.zip opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.tar.gz opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.tar.bz2 |
- fix monitor mode on orinoco. Although WE > 14 define the standard mode
"MONITOR", the orinoco monitor patch for 0.13e still does not use that...
- add documentation, a warning, and a runtime check for setChannel(0)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 12 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 45ee4c0..767651e 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -588,16 +588,22 @@ int OWirelessNetworkInterface::channel() const { return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; } } void OWirelessNetworkInterface::setChannel( int c ) const { + if ( c ) + { + qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); + return; + } + if ( !_mon ) { memset( &_iwr, 0, sizeof( struct iwreq ) ); _iwr.u.freq.m = c; _iwr.u.freq.e = 0; wioctl( SIOCSIWFREQ ); } else @@ -934,17 +940,17 @@ QString OWlanNGMonitoringInterface::name() const void OWlanNGMonitoringInterface::setChannel( int c ) { //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. QString enable = "true"; //_if->monitorMode() ? "true" : "false"; QString prism = _prismHeader ? "true" : "false"; QString cmd; cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", - (const char*) _if->name(), c+1, (const char*) enable, (const char*) prism ); + (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); system( cmd ); } /*====================================================================================== * OHostAPMonitoringInterface *======================================================================================*/ @@ -1010,18 +1016,20 @@ void OOrinocoMonitoringInterface::setChannel( int c ) _if->setPrivate( "monitor", 2, monitorCode, c ); } void OOrinocoMonitoringInterface::setEnabled( bool b ) { // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring + // However, as of recent orinoco drivers, IW_MODE_MONITOR is still not supported - #if WIRELESS_EXT > 14 + #if 0 + //#if WIRELESS_EXT > 14 if ( b ) _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header else _if->setMode( "managed" ); #else if ( b ) { setChannel( 1 ); diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 2553a61..00d1ebb 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -331,16 +331,18 @@ class OWirelessNetworkInterface : public ONetworkInterface OWirelessNetworkInterface( QObject* parent, const char* name ); /** * Destructor. */ virtual ~OWirelessNetworkInterface(); /** * Setting the @a channel of the interface changes the radio frequency (RF) * of the corresponding wireless network device. + * @note Common channel range is within [1-14]. A value of 0 is not allowed. + * @see channels() */ virtual void setChannel( int channel ) const; /** * @returns the channel index of the current radio frequency. */ virtual int channel() const; /** * @returns the current radio frequency (in MHz). |