Packets/DefaultBundle: ICMPv6Packet skips checksum calculation when IPv6 header is...
g0dil [Thu, 5 Mar 2009 15:05:46 +0000 (15:05 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1145 270642c3-0616-0410-b53a-bc976706d245

Packets/DefaultBundle/ICMPv6Packet.cc

index dc8eea1..0556fec 100644 (file)
@@ -34,10 +34,15 @@ namespace {
         registerICMPv6Packet (58);
 }
 
-prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() const {
+prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() 
+    const
+{
 
     senf::IpChecksum summer;
     senf::IPv6Packet ipv6 (packet().rfind<senf::IPv6Packet>(senf::nothrow));
+
+    if (! ipv6)
+        return 0u;
     
     summer.feed( ipv6->source().i(), 
                     ipv6->source().i() + senf::IPv6Packet::Parser::source_t::fixed_bytes );