Change ICMPv6 checksum calculation to use IP_Hdr wrapper.

So that src/dst addresses used in pseudo-header are correct when
there's certain extension headers (routing/destination).

Add ICMP/ICMPv6 checksum unit tests.
This commit is contained in:
Jon Siwek 2012-04-10 11:37:08 -05:00
parent 958c6c7cf4
commit 27ba3118c1
12 changed files with 19 additions and 7 deletions

View file

@ -65,18 +65,17 @@ inline int seq_delta(uint32 a, uint32 b)
}
class IPAddr;
class IP_Hdr;
// Returns the ones-complement checksum of a chunk of b short-aligned bytes.
extern int ones_complement_checksum(const void* p, int b, uint32 sum);
extern int ones_complement_checksum(const IPAddr& a, uint32 sum);
extern int icmp6_checksum(const struct icmp* icmpp, const struct ip6_hdr* ip6,
int len);
extern int icmp6_checksum(const struct icmp* icmpp, const IP_Hdr* ip, int len);
extern int icmp_checksum(const struct icmp* icmpp, int len);
#ifdef ENABLE_MOBILE_IPV6
class IP_Hdr;
extern int mobility_header_checksum(const IP_Hdr* ip);
#endif