author | mickeyl <mickeyl> | 2003-05-05 14:57:27 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-05 14:57:27 (UTC) |
commit | 29f5c6e6bcb8db0f0e26da25dbf34b2685c01526 (patch) (side-by-side diff) | |
tree | a05e296ff11d532fd3d5fd092aade07474d1ba95 /libopie2 | |
parent | a5818261bec2d0a6d903fef9baeed1a7abc85275 (diff) | |
download | opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.zip opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.tar.gz opie-29f5c6e6bcb8db0f0e26da25dbf34b2685c01526.tar.bz2 |
- fix segfault on unknown linktype (thanks groucho)
- make capturing using PRISM headers optional
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 31 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 11 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 2 |
3 files changed, 25 insertions, 19 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 2dfff1d..6cef5cf 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -808,10 +808,10 @@ bool OWirelessNetworkInterface::wioctl( int call ) const /*====================================================================================== * OMonitoringInterface *======================================================================================*/ -OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface ) - :_if( static_cast<OWirelessNetworkInterface*>( iface ) ) +OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) + :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) { } @@ -844,10 +844,10 @@ void OMonitoringInterface::setEnabled( bool b ) /*====================================================================================== * OCiscoMonitoringInterface *======================================================================================*/ -OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface ) - :OMonitoringInterface( iface ) +OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) + :OMonitoringInterface( iface, prismHeader ) { iface->setMonitoring( this ); } @@ -892,10 +892,10 @@ void OCiscoMonitoringInterface::setChannel( int ) * OWlanNGMonitoringInterface *======================================================================================*/ -OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface ) - :OMonitoringInterface( iface ) +OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) + :OMonitoringInterface( iface, prismHeader ) { iface->setMonitoring( this ); } @@ -909,10 +909,12 @@ void OWlanNGMonitoringInterface::setEnabled( bool b ) { //FIXME: do nothing if its already in the same mode QString enable = b ? "true" : "false"; + QString prism = _prismHeader ? "true" : "false"; QString cmd; - cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s", (const char*) _if->name(), 1, (const char*) enable ); + cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", + (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); system( cmd ); } @@ -931,10 +933,10 @@ void OWlanNGMonitoringInterface::setChannel( int ) /*====================================================================================== * OHostAPMonitoringInterface *======================================================================================*/ -OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface ) - :OMonitoringInterface( iface ) +OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) + :OMonitoringInterface( iface, prismHeader ) { iface->setMonitoring( this ); } @@ -949,11 +951,13 @@ void OHostAPMonitoringInterface::setEnabled( bool b ) //TODO: check wireless extensions version on runtime and use //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15 + int monitorCode = _prismHeader ? 1 : 2; + if ( b ) { - _if->setPrivate( "monitor", 1, 2 ); + _if->setPrivate( "monitor", 1, monitorCode ); } else { _if->setPrivate( "monitor", 1, 0 ); @@ -970,10 +974,10 @@ QString OHostAPMonitoringInterface::name() const /*====================================================================================== * OOrinocoNetworkInterface *======================================================================================*/ -OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface ) - :OMonitoringInterface( iface ) +OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) + :OMonitoringInterface( iface, prismHeader ) { iface->setMonitoring( this ); } @@ -984,9 +988,10 @@ OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() void OOrinocoMonitoringInterface::setChannel( int c ) { - _if->setPrivate( "monitor", 2, 1, c ); + int monitorCode = _prismHeader ? 1 : 2; + _if->setPrivate( "monitor", 2, monitorCode, c ); } void OOrinocoMonitoringInterface::setEnabled( bool b ) diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 1b38d02..eb9d506 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -451,9 +451,9 @@ class OWirelessNetworkInterface : public ONetworkInterface class OMonitoringInterface { public: OMonitoringInterface(); - OMonitoringInterface( ONetworkInterface* ); + OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); virtual ~OMonitoringInterface(); public: virtual void setEnabled( bool ); @@ -463,8 +463,9 @@ class OMonitoringInterface virtual QString name() const = 0; protected: OWirelessNetworkInterface* _if; + bool _prismHeader; }; @@ -475,9 +476,9 @@ class OMonitoringInterface class OCiscoMonitoringInterface : public OMonitoringInterface { public: - OCiscoMonitoringInterface( ONetworkInterface* ); + OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); virtual ~OCiscoMonitoringInterface(); virtual void setEnabled( bool ); virtual QString name() const; @@ -491,9 +492,9 @@ class OCiscoMonitoringInterface : public OMonitoringInterface class OWlanNGMonitoringInterface : public OMonitoringInterface { public: - OWlanNGMonitoringInterface( ONetworkInterface* ); + OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); virtual ~OWlanNGMonitoringInterface(); public: virtual void setEnabled( bool ); @@ -508,9 +509,9 @@ class OWlanNGMonitoringInterface : public OMonitoringInterface class OHostAPMonitoringInterface : public OMonitoringInterface { public: - OHostAPMonitoringInterface( ONetworkInterface* ); + OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); virtual ~OHostAPMonitoringInterface(); public: virtual void setEnabled( bool ); @@ -523,9 +524,9 @@ class OHostAPMonitoringInterface : public OMonitoringInterface class OOrinocoMonitoringInterface : public OMonitoringInterface { public: - OOrinocoMonitoringInterface( ONetworkInterface* ); + OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); virtual ~OOrinocoMonitoringInterface(); public: virtual void setChannel( int ); diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index e2ab6d7..f6d05ea 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -70,9 +70,9 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); break; default: - qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink '%s'!", datalink ); + qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink (type %d)!", datalink ); } } |