From 1e366e382cf3e7e4686c515630f97220e95e7674 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Fri, 18 Nov 2011 00:05:59 -0200 Subject: [PATCH] Bug: the match() method cannot consider the source address from IP header, once the IPHeader object is not initialized in the read() method. We must figure out why the IPv6 data does not come in the istream like IPv4 data. --- src/icmp/icmpv6packet.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/icmp/icmpv6packet.cpp b/src/icmp/icmpv6packet.cpp index 02a08f2..71f0f6f 100644 --- a/src/icmp/icmpv6packet.cpp +++ b/src/icmp/icmpv6packet.cpp @@ -144,9 +144,15 @@ bool Icmpv6Packet::match( bool type_match = IcmpPayloadHeader.get_type() == type ? true : false; bool identifier_match = IcmpPayloadHeader.get_identifier() == identifier ? true: false; bool seq_num_match = IcmpPayloadHeader.get_sequence_number() == sequence_number ? true : false; +#ifdef IPV6_DATA_PRESENT_IN_ISTREAM + // TODO operator>> does not read IpHeader, thus this object is not initialized + // must check why IPv6 data does not come in the istream like IPv4 data bool address_match = IpHeader.get_source_address() == source_address ? true : false; return ( type_match && identifier_match && seq_num_match && address_match ); +#else + return ( type_match && identifier_match && seq_num_match ); +#endif } /** @@ -225,9 +231,12 @@ istream& operator>>( Icmpv6Packet &packet ) { +#ifdef IPV6_DATA_PRESENT_IN_ISTREAM //TODO WHY IPv6 does not come like IPv4???? - //is >> packet.IpHeader >> packet.IcmpPayloadHeader >> packet.IcmpPayloadData; + is >> packet.IpHeader >> packet.IcmpPayloadHeader >> packet.IcmpPayloadData; +#else is >> packet.IcmpPayloadHeader >> packet.IcmpPayloadData; +#endif return is; } -- 1.7.1