summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2003-03-30 14:48:08 (UTC)
committer mickeyl <mickeyl>2003-03-30 14:48:08 (UTC)
commitf921599651459b393e6a9846a1ecf7551323f4c2 (patch) (unidiff)
tree1fe6c881d29597c289a2dbbc30ad020996faac91 /libopie2
parent9e3dc048e171af6d88f0cc3f16ad0c9fb6a15ce2 (diff)
downloadopie-f921599651459b393e6a9846a1ecf7551323f4c2.zip
opie-f921599651459b393e6a9846a1ecf7551323f4c2.tar.gz
opie-f921599651459b393e6a9846a1ecf7551323f4c2.tar.bz2
- implement switching monitor mode on hostap
- work around damn buggy hostap drivers needing more space for SIOCGIWRANGE than defined by sizeof(struct iw_range)...
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp41
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
@@ -376,14 +376,16 @@ void OWirelessNetworkInterface::init()
376 376
377 memset( &_iwr, 0, sizeof( struct iwreq ) ); 377 memset( &_iwr, 0, sizeof( struct iwreq ) );
378 378
379 // IEEE802.11(b) radio frequency channels 379 // IEEE802.11(b) radio frequency channels
380 //FIXME: get these directly from the interface
381 //FIXME: check if these channels are off-by-one
382 380
383 iwrangestruct range; 381 iwrangestruct range;
382 //ML: work around an ugly HostAP bug, which needs
383 //ML: extra space or will complain with "invalid argument length"... :-(
384 char __extraBufferForBuggyDrivers[sizeof range];
384 _iwr.u.data.pointer = (char*) &range; 385 _iwr.u.data.pointer = (char*) &range;
385 _iwr.u.data.length = sizeof( iwrangestruct ); 386 _iwr.u.data.length = (sizeof range) * 2;
387 _iwr.u.data.flags = 0;
386 if ( !wioctl( SIOCGIWRANGE ) ) 388 if ( !wioctl( SIOCGIWRANGE ) )
387 { 389 {
388 qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) ); 390 qDebug( "OWirelessNetworkInterface::init(): SIOCGIWRANGE failed (%s)", strerror( errno ) );
389 return; 391 return;
@@ -720,17 +722,32 @@ void OHostAPMonitoringInterface::setEnabled( bool b )
720{ 722{
721 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 723 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
722 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring 724 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring
723 725
724 #if WIRELESS_EXT > 14 726 if ( b )
725 _if->_iwr.u.mode = IW_MODE_MONITOR; 727 {
726 _if->wioctl( SIOCSIWMODE ); 728 #if WIRELESS_EXT > 14
727 #else 729 _if->_iwr.u.mode = IW_MODE_MONITOR;
728 int* args = (int*) &_if->_iwr.u.name; 730 _if->wioctl( SIOCSIWMODE );
729 args[0] = 2; 731 #else
730 args[1] = 0; 732 int* args = (int*) &_if->_iwr.u.name;
731 _if->wioctl( SIOCDEVPRIVATE ); 733 args[0] = 2;
732 #endif 734 args[1] = 0;
735 _if->wioctl( SIOCDEVPRIVATE );
736 #endif
737 }
738 else
739 {
740 #if WIRELESS_EXT > 14
741 _if->_iwr.u.mode = IW_MODE_INFRA;
742 _if->wioctl( SIOCSIWMODE );
743 #else
744 int* args = (int*) &_if->_iwr.u.name;
745 args[0] = 0;
746 args[1] = 0;
747 _if->wioctl( SIOCDEVPRIVATE );
748 #endif
749 }
733 750
734 OMonitoringInterface::setEnabled( b ); 751 OMonitoringInterface::setEnabled( b );
735} 752}
736 753