summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-07-01 22:08:53 (UTC)
committer mickeyl <mickeyl>2003-07-01 22:08:53 (UTC)
commitfbf388246a16c1cd36e209ba24731929b93c21c0 (patch) (side-by-side diff)
treec6fd6bf3f6e341460feec4cca67355ac04f845ac
parentd12216b371c89ee1142ade36e7e519041bcb8370 (diff)
downloadopie-fbf388246a16c1cd36e209ba24731929b93c21c0.zip
opie-fbf388246a16c1cd36e209ba24731929b93c21c0.tar.gz
opie-fbf388246a16c1cd36e209ba24731929b93c21c0.tar.bz2
add monitor mode handling for recent kernels (WE>14)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp28
-rw-r--r--libopie2/opienet/onetwork.h8
2 files changed, 29 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 6cef5cf..751d841 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -67,6 +67,7 @@ ONetwork* ONetwork::_instance = 0;
ONetwork::ONetwork()
{
qDebug( "ONetwork::ONetwork()" );
+ qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT );
synchronize();
}
@@ -109,6 +110,12 @@ void ONetwork::synchronize()
}
+short ONetwork::wirelessExtensionVersion()
+{
+ return WIRELESS_EXT;
+}
+
+
int ONetwork::count() const
{
return _interfaces.count();
@@ -949,11 +956,13 @@ void OHostAPMonitoringInterface::setEnabled( bool b )
// IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
// Wireless Extensions < Version 15 need iwpriv commandos for monitoring
- //TODO: check wireless extensions version on runtime and use
- //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15
-
+ #if WIRELESS_EXT > 14
+ if ( b )
+ _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header
+ else
+ _if->setMode( "managed" );
+ #else
int monitorCode = _prismHeader ? 1 : 2;
-
if ( b )
{
_if->setPrivate( "monitor", 1, monitorCode );
@@ -962,6 +971,7 @@ void OHostAPMonitoringInterface::setEnabled( bool b )
{
_if->setPrivate( "monitor", 1, 0 );
}
+ #endif
}
@@ -996,6 +1006,15 @@ void OOrinocoMonitoringInterface::setChannel( int 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
+
+ #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 );
@@ -1004,6 +1023,7 @@ void OOrinocoMonitoringInterface::setEnabled( bool b )
{
_if->setPrivate( "monitor", 2, 0, 0 );
}
+ #endif
}
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index cfb999d..2553a61 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -104,13 +104,11 @@ class ONetwork : public QObject
/**
* @returns true, if the @a interface supports the wireless extension protocol.
*/
- // FIXME QString? -zecke
bool isWirelessInterface( const char* interface ) const;
/**
- * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found
+ * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found.
* @see ONetworkInterface
*/
- // FIXME: const QString& is prefered over QString!!! -zecke
ONetworkInterface* interface( const QString& interface ) const;
/**
* @internal Rebuild the internal interface database
@@ -118,6 +116,10 @@ class ONetwork : public QObject
* e.g. after issuing a cardctl insert
*/
void synchronize();
+ /**
+ * @returns the wireless extension version used at compile time.
+ **/
+ static short wirelessExtensionVersion();
protected:
ONetwork();