author | mickeyl <mickeyl> | 2003-10-06 17:38:00 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-06 17:38:00 (UTC) |
commit | e0acd0d9400bb489415d21ec715c5f6704c22b95 (patch) (unidiff) | |
tree | a6bb6077c3da3d31bc9e86d6f8276aed90bd3d5c | |
parent | 634a68b636a0fa24232029b79ffa915a5621b2be (diff) | |
download | opie-e0acd0d9400bb489415d21ec715c5f6704c22b95.zip opie-e0acd0d9400bb489415d21ec715c5f6704c22b95.tar.gz opie-e0acd0d9400bb489415d21ec715c5f6704c22b95.tar.bz2 |
decode DHCP ACK packets and show the extracted client IP address
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 9d6ed6a..1cca507 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -362,33 +362,33 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, | |||
362 | #endif | 362 | #endif |
363 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 363 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
364 | } | 364 | } |
365 | 365 | ||
366 | if ( subitem ) | 366 | if ( subitem ) |
367 | { | 367 | { |
368 | // we have already seen this item, it's a dupe | 368 | // we have already seen this item, it's a dupe |
369 | #ifdef DEBUG | 369 | #ifdef DEBUG |
370 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); | 370 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); |
371 | #endif | 371 | #endif |
372 | subitem->receivedBeacon(); //FIXME: sent data bit | 372 | subitem->receivedBeacon(); //FIXME: sent data bit |
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | 375 | ||
376 | // never seen that - add new item | 376 | // never seen that - add new item |
377 | 377 | ||
378 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", false, -1, -1 ); | 378 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
379 | item->setText( col_essid, name ); | 379 | item->setText( col_essid, name ); |
380 | 380 | ||
381 | return; | 381 | return; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 384 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
385 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 385 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
386 | (const char*) macaddr.toString(), (const char*) ip ) ); | 386 | (const char*) macaddr.toString(), (const char*) ip ) ); |
387 | } | 387 | } |
388 | 388 | ||
389 | 389 | ||
390 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 390 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
391 | { | 391 | { |
392 | if ( !item ) return; | 392 | if ( !item ) return; |
393 | 393 | ||
394 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 394 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 7394742..9460f56 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -243,38 +243,41 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, | |||
243 | { | 243 | { |
244 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 244 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
245 | } | 245 | } |
246 | else if ( arp->type() == "REPLY" ) | 246 | else if ( arp->type() == "REPLY" ) |
247 | { | 247 | { |
248 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 248 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
249 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 249 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); | 253 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
254 | if ( dhcp ) | 254 | if ( dhcp ) |
255 | { | 255 | { |
256 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | 256 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); |
257 | if ( dhcp->type() == "OFFER" ) | 257 | if ( dhcp->type() == "OFFER" ) |
258 | { | 258 | { |
259 | qDebug( "ADDSERVICE: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); | 259 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); |
260 | //netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); | ||
261 | |||
262 | netView()->identify( source, dhcp->serverAddress().toString() ); | 260 | netView()->identify( source, dhcp->serverAddress().toString() ); |
263 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 261 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
264 | } | 262 | } |
263 | else if ( dhcp->type() == "ACK" ) | ||
264 | { | ||
265 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); | ||
266 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | ||
267 | } | ||
265 | } | 268 | } |
266 | } | 269 | } |
267 | 270 | ||
268 | 271 | ||
269 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 272 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
270 | { | 273 | { |
271 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 274 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |
272 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) | 275 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) |
273 | return 0; | 276 | return 0; |
274 | 277 | ||
275 | return p->child( protocol ); | 278 | return p->child( protocol ); |
276 | } | 279 | } |
277 | 280 | ||
278 | 281 | ||
279 | bool Wellenreiter::checkDumpPacket( OPacket* p ) | 282 | bool Wellenreiter::checkDumpPacket( OPacket* p ) |
280 | { | 283 | { |