-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index 7ce096f..e7d6ff5 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp @@ -330,50 +330,50 @@ void WLANImp::rescanNeighbourhood() { qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); return; } else { qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); } // configure interface to receive 802.11 management frames wiface->setUp( true ); wiface->setPromiscuousMode( true ); if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); else { qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); return; } - wiface->setMonitorMode( true ); - if ( !wiface->monitorMode() ) + wiface->setMode( "monitor" ); + if ( wiface->mode() != "monitor" ) { qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); return; } // open a packet capturer OPacketCapturer* cap = new OPacketCapturer(); cap->open( name ); if ( !cap->isOpen() ) { qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); return; } // display splash screen QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); splash->setLineWidth( 2 ); splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); vbox->addWidget( lab ); vbox->addWidget( pb ); pb->setCenterIndicator( true ); @@ -389,50 +389,50 @@ void WLANImp::rescanNeighbourhood() qApp->processEvents(); // set capturer to non-blocking mode cap->setBlocking( false ); for ( int i = 1; i <= wiface->channels(); ++i ) { wiface->setChannel( i ); pb->setProgress( i ); qApp->processEvents(); qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); OPacket* p = cap->next( 1000 ); if ( !p ) { qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); } else { qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); handlePacket( p ); } } cap->close(); - wiface->setMonitorMode( false ); - wiface->setPromiscuousMode( true ); + wiface->setMode( "managed" ); // TODO: use previous mode + wiface->setPromiscuousMode( false ); splash->hide(); delete splash; } void WLANImp::handlePacket( OPacket* p ) { // check if we received a beacon frame OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); if ( beacon && beacon->managementType() == "Beacon" ) { QString type; if ( beacon->canIBSS() ) { type = "adhoc"; } else if ( beacon->canESS() ) { type = "managed"; } else |