summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-04 13:46:27 (UTC)
committer mickeyl <mickeyl>2003-04-04 13:46:27 (UTC)
commit2349ef8fd3999798a2cbbb62a88e71807f25ae40 (patch) (unidiff)
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) (show 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
@@ -177,48 +177,54 @@ void Wellenreiter::startStopClicked()
177 if ( ( interface == "" ) || ( cardtype == 0 ) ) 177 if ( ( interface == "" ) || ( cardtype == 0 ) )
178 { 178 {
179 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); 179 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
180 return; 180 return;
181 } 181 }
182 182
183 // configure device 183 // configure device
184 184
185 ONetwork* net = ONetwork::instance(); 185 ONetwork* net = ONetwork::instance();
186 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 186 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
187 187
188 // set monitor mode 188 // set monitor mode
189 189
190 switch ( cardtype ) 190 switch ( cardtype )
191 { 191 {
192 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; 192 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
193 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; 193 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
194 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; 194 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
195 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; 195 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
196 default: assert( 0 ); // shouldn't happen 196 default: assert( 0 ); // shouldn't happen
197 } 197 }
198 198
199 iface->setMonitorMode( true ); 199 iface->setMonitorMode( true );
200 200
201 if ( !iface->monitorMode() )
202 {
203 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
204 return;
205 }
206
201 // open pcap and start sniffing 207 // open pcap and start sniffing
202 pcap->open( interface ); 208 pcap->open( interface );
203 209
204 if ( !pcap->isOpen() ) 210 if ( !pcap->isOpen() )
205 { 211 {
206 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); 212 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
207 return; 213 return;
208 } 214 }
209 215
210 // set capturer to non-blocking mode 216 // set capturer to non-blocking mode
211 pcap->setBlocking( false ); 217 pcap->setBlocking( false );
212 218
213 // start channel hopper 219 // start channel hopper
214 iface->setChannelHopping( 1000 ); //use interval from config window 220 iface->setChannelHopping( 1000 ); //use interval from config window
215 221
216 // connect 222 // connect
217 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 223 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
218 224
219 logwindow->log( "(i) Daemon has been started." ); 225 logwindow->log( "(i) Daemon has been started." );
220 #ifdef QWS 226 #ifdef QWS
221 oApp->setTitle( "Scanning ..." ); 227 oApp->setTitle( "Scanning ..." );
222 #else 228 #else
223 qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); 229 qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." );
224 #endif 230 #endif