summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-04 13:46:27 (UTC)
committer mickeyl <mickeyl>2003-04-04 13:46:27 (UTC)
commit2349ef8fd3999798a2cbbb62a88e71807f25ae40 (patch) (side-by-side diff)
tree25dc954dcb7028de379247cb8266b3c980505368
parentb2153d44e64c1ade3ee141ea24075add1fd33777 (diff)
downloadopie-2349ef8fd3999798a2cbbb62a88e71807f25ae40.zip
opie-2349ef8fd3999798a2cbbb62a88e71807f25ae40.tar.gz
opie-2349ef8fd3999798a2cbbb62a88e71807f25ae40.tar.bz2
detect and warn if switching device into monitor mode doesn't work
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index e294eb8..d80a6e6 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -153,76 +153,82 @@ void Wellenreiter::startStopClicked()
// get interface name from config window
const QString& interface = configwindow->interfaceName->currentText();
ONetwork* net = ONetwork::instance();
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
// switch off monitor mode
iface->setMonitorMode( false );
// switch off promisc flag
iface->setPromiscuousMode( false );
system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
// message the user
QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
}
else
{
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
const int cardtype = configwindow->daemonDeviceType();
const int interval = configwindow->daemonHopInterval();
if ( ( interface == "" ) || ( cardtype == 0 ) )
{
QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
return;
}
// configure device
ONetwork* net = ONetwork::instance();
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
// set monitor mode
switch ( cardtype )
{
case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
default: assert( 0 ); // shouldn't happen
}
iface->setMonitorMode( true );
+ if ( !iface->monitorMode() )
+ {
+ QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
+ return;
+ }
+
// open pcap and start sniffing
pcap->open( interface );
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
iface->setChannelHopping( 1000 ); //use interval from config window
// connect
connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
logwindow->log( "(i) Daemon has been started." );
#ifdef QWS
oApp->setTitle( "Scanning ..." );
#else
qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." );
#endif
sniffing = true;
}
}