author | mickeyl <mickeyl> | 2004-03-28 13:39:39 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-28 13:39:39 (UTC) |
commit | ca32f9c2a799aec751efd82e73c3154de1afe957 (patch) (side-by-side diff) | |
tree | 4577ffe310acac81451235a4b11f0bf2ec86c3bc | |
parent | 0821e9018b0a3b1ea11ff5a4454db2e047d94d88 (diff) | |
download | opie-ca32f9c2a799aec751efd82e73c3154de1afe957.zip opie-ca32f9c2a799aec751efd82e73c3154de1afe957.tar.gz opie-ca32f9c2a799aec751efd82e73c3154de1afe957.tar.bz2 |
fix stupid bug that broke replaying capture files
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e8d9de7..c8d77a7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -497,61 +497,62 @@ void Wellenreiter::stopClicked() statwindow->updateCounter( it.key(), it.data() ); } void Wellenreiter::startClicked() { // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->driverType(); const int interval = configwindow->hoppingInterval(); if ( ( interface == "" ) || ( cardtype == 0 ) ) { QMessageBox::information( this, "Wellenreiter II", tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); return; } // configure device ONetwork* net = ONetwork::instance(); // TODO: check if interface is wireless and support sniffing for non-wireless interfaces - if ( !net->isPresent( interface ) ) - { - QMessageBox::information( this, "Wellenreiter II", - tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); - return; - } - - iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! - assert( iface ); - - // bring device UP if ( cardtype != DEVTYPE_FILE ) { + + if ( !net->isPresent( interface ) ) + { + QMessageBox::information( this, "Wellenreiter II", + tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); + return; + } + + iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! + assert( iface ); + + // bring device UP iface->setUp( true ); if ( !iface->isUp() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); return; } } // set monitor mode bool usePrism = configwindow->usePrismHeader(); switch ( cardtype ) { case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode if ( cardtype < DEVTYPE_FILE ) @@ -623,49 +624,49 @@ void Wellenreiter::startClicked() else { // start timer for reading packets startTimer( 100 ); } logwindow->log( "(i) Started Scanning." ); sniffing = true; #ifdef QWS if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) { QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; } #else #warning FIXME: setScreenSaverMode is not operational on the X11 build #endif emit( startedSniffing() ); if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title else { assert( parent() ); ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); - } + } } void Wellenreiter::timerEvent( QTimerEvent* ) { qDebug( "Wellenreiter::timerEvent()" ); OPacket* p = pcap->next(); if ( !p ) // no more packets available { stopClicked(); } else { receivePacket( p ); delete p; } } void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) { #ifdef QWS if ( action == "TouchSound" ) ODevice::inst()->playTouchSound(); |