summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 965f6b0..4257be1 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -400,18 +400,25 @@ void Wellenreiter::startClicked()
400 QMessageBox::information( this, "Wellenreiter II", 400 QMessageBox::information( this, "Wellenreiter II",
401 tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); 401 tr( "Your device is not\nproperly configured. Please reconfigure!" ) );
402 return; 402 return;
403 } 403 }
404 404
405 // configure device 405 // configure device
406
407 ONetwork* net = ONetwork::instance(); 406 ONetwork* net = ONetwork::instance();
408 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 407 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
409 408
410 // set monitor mode 409 // bring device UP
410 iface->setUp( true );
411 if ( !iface->isUp() )
412 {
413 QMessageBox::warning( this, "Wellenreiter II",
414 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
415 return;
416 }
411 417
418 // set monitor mode
412 bool usePrism = configwindow->usePrismHeader(); 419 bool usePrism = configwindow->usePrismHeader();
413 420
414 switch ( cardtype ) 421 switch ( cardtype )
415 { 422 {
416 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 423 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
417 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 424 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
@@ -427,13 +434,13 @@ void Wellenreiter::startClicked()
427 { 434 {
428 if ( cardtype != DEVTYPE_MANUAL ) 435 if ( cardtype != DEVTYPE_MANUAL )
429 iface->setMonitorMode( true ); 436 iface->setMonitorMode( true );
430 if ( !iface->monitorMode() ) 437 if ( !iface->monitorMode() )
431 { 438 {
432 QMessageBox::warning( this, "Wellenreiter II", 439 QMessageBox::warning( this, "Wellenreiter II",
433 tr( "Can't set device into monitor mode." ) ); 440 tr( "Can't set interface '%1' into monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) );
434 return; 441 return;
435 } 442 }
436 } 443 }
437 444
438 // open pcap and start sniffing 445 // open pcap and start sniffing
439 if ( cardtype != DEVTYPE_FILE ) 446 if ( cardtype != DEVTYPE_FILE )
@@ -458,13 +465,13 @@ void Wellenreiter::startClicked()
458 pcap->open( QFile( interface ) ); 465 pcap->open( QFile( interface ) );
459 } 466 }
460 467
461 if ( !pcap->isOpen() ) 468 if ( !pcap->isOpen() )
462 { 469 {
463 QMessageBox::warning( this, "Wellenreiter II", 470 QMessageBox::warning( this, "Wellenreiter II",
464 tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); 471 tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) ));
465 return; 472 return;
466 } 473 }
467 474
468 // set capturer to non-blocking mode 475 // set capturer to non-blocking mode
469 pcap->setBlocking( false ); 476 pcap->setBlocking( false );
470 477
@@ -527,6 +534,7 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa
527 else if ( action == "LogMessage" ) 534 else if ( action == "LogMessage" )
528 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 535 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
529 else if ( action == "MessageBox" ) 536 else if ( action == "MessageBox" )
530 QMessageBox::information ( this, "Notification!", 537 QMessageBox::information ( this, "Notification!",
531 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 538 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
532} 539}
540