summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-03-31 15:00:44 (UTC)
committer mickeyl <mickeyl>2003-03-31 15:00:44 (UTC)
commitf3b37f3dd4ae27e809415af67dd4df052d72d076 (patch) (unidiff)
tree36216a0e3543b11499da3ea56e2e0695c188c49d
parent13e8e8cbaede72948d3901a1a903eba43854d770 (diff)
downloadopie-f3b37f3dd4ae27e809415af67dd4df052d72d076.zip
opie-f3b37f3dd4ae27e809415af67dd4df052d72d076.tar.gz
opie-f3b37f3dd4ae27e809415af67dd4df052d72d076.tar.bz2
only cardctl reset after sniffing. maybe later make calling dhcp client a configurable option.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index d1dd73a..e294eb8 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -115,97 +115,97 @@ void Wellenreiter::receivePacket(OPacket* p)
115 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 115 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
116 if ( !beacon ) return; 116 if ( !beacon ) return;
117 QString type; 117 QString type;
118 118
119 //FIXME: Can stations in ESS mode can be distinguished from APs? 119 //FIXME: Can stations in ESS mode can be distinguished from APs?
120 //FIXME: Apparently yes, but not by listening to beacons, because 120 //FIXME: Apparently yes, but not by listening to beacons, because
121 //FIXME: they simply don't send beacons in infrastructure mode. 121 //FIXME: they simply don't send beacons in infrastructure mode.
122 //FIXME: so we also have to listen to data packets 122 //FIXME: so we also have to listen to data packets
123 123
124 if ( beacon->canIBSS() ) 124 if ( beacon->canIBSS() )
125 type = "adhoc"; 125 type = "adhoc";
126 else 126 else
127 type = "managed"; 127 type = "managed";
128 128
129 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 129 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
130 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 130 QString essid = ssid ? ssid->ID() : QString("<unknown>");
131 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 131 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
132 int channel = ds ? ds->channel() : -1; 132 int channel = ds ? ds->channel() : -1;
133 133
134 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 134 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
135 netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); 135 netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 );
136} 136}
137 137
138void Wellenreiter::startStopClicked() 138void Wellenreiter::startStopClicked()
139{ 139{
140 if ( sniffing ) 140 if ( sniffing )
141 { 141 {
142 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 142 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
143 143
144 iface->setChannelHopping(); // stop hopping channels 144 iface->setChannelHopping(); // stop hopping channels
145 pcap->close(); 145 pcap->close();
146 sniffing = false; 146 sniffing = false;
147 #ifdef QWS 147 #ifdef QWS
148 oApp->setTitle(); 148 oApp->setTitle();
149 #else 149 #else
150 qApp->mainWidget()->setCaption( "Wellenreiter II" ); 150 qApp->mainWidget()->setCaption( "Wellenreiter II" );
151 #endif 151 #endif
152 152
153 // get interface name from config window 153 // get interface name from config window
154 const QString& interface = configwindow->interfaceName->currentText(); 154 const QString& interface = configwindow->interfaceName->currentText();
155 ONetwork* net = ONetwork::instance(); 155 ONetwork* net = ONetwork::instance();
156 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 156 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
157 157
158 // switch off monitor mode 158 // switch off monitor mode
159 iface->setMonitorMode( false ); 159 iface->setMonitorMode( false );
160 // switch off promisc flag 160 // switch off promisc flag
161 iface->setPromiscuousMode( false ); 161 iface->setPromiscuousMode( false );
162 162
163 system( "cardctl reset; sleep 1; dhclient; udhcpc" ); //FIXME: Use OProcess 163 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
164 164
165 // message the user 165 // message the user
166 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); 166 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
167 } 167 }
168 168
169 else 169 else
170 { 170 {
171 // get configuration from config window 171 // get configuration from config window
172 172
173 const QString& interface = configwindow->interfaceName->currentText(); 173 const QString& interface = configwindow->interfaceName->currentText();
174 const int cardtype = configwindow->daemonDeviceType(); 174 const int cardtype = configwindow->daemonDeviceType();
175 const int interval = configwindow->daemonHopInterval(); 175 const int interval = configwindow->daemonHopInterval();
176 176
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 // open pcap and start sniffing 201 // open pcap and start sniffing
202 pcap->open( interface ); 202 pcap->open( interface );
203 203
204 if ( !pcap->isOpen() ) 204 if ( !pcap->isOpen() )
205 { 205 {
206 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); 206 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
207 return; 207 return;
208 } 208 }
209 209
210 // set capturer to non-blocking mode 210 // set capturer to non-blocking mode
211 pcap->setBlocking( false ); 211 pcap->setBlocking( false );