From b8ac6724a0aaed78a1df712d87110fe39b16955f Mon Sep 17 00:00:00 2001 From: mickeyl Date: Mon, 06 Oct 2003 18:08:05 +0000 Subject: fix ARP decoding for wired networks. Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol. --- (limited to 'noncore/net/wellenreiter') diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 9460f56..60bf231 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -233,7 +233,7 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd } -void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) @@ -249,6 +249,12 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); } } +} + + +void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) +{ + //TODO: Implement more IP based protocols ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); if ( dhcp ) @@ -349,6 +355,14 @@ void Wellenreiter::receivePacket( OPacket* p ) handleEthernetData( p, eth, source, dest ); } + // check for an arp frame since arp frames come in two flavours: + // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. + OARPPacket* arp = static_cast( childIfToParse( p, "ARP" ) ); + if ( arp ) + { + handleARPData( p, arp, source, dest ); + } + // check for a ip frame OIPPacket* ip = static_cast( childIfToParse( p, "IP" ) ); if ( ip ) diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index ed96375..25a5e8d 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -29,6 +29,7 @@ class OPacket; class OWaveLanManagementPacket; class OWaveLanDataPacket; class OEthernetPacket; +class OARPPacket; class OMacAddress; class OIPPacket; class OPacketCapturer; @@ -73,6 +74,7 @@ class Wellenreiter : public WellenreiterBase { void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); + void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); void handleNotification( OPacket* p ); void doAction( const QString& action, const QString& protocol, OPacket* p ); -- cgit v0.9.0.2