Bug 34

Summary: ip checksum calculation is disabled
Product: ns-3 Reporter: Mathieu Lacage <mathieu.lacage>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P1    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: Add ipv4 checksum support.
Add ipv4 header checksum support.

Description Mathieu Lacage 2007-06-01 09:09:37 UTC
It was disabled after some changes to the Packet/Buffer API a few months ago. To re-enable it, I think that the right way to go is to add 
uint32_t Buffer::CalculateIpChecksum (Buffer::Iterator start, Buffer::Iterator end);
Comment 1 Florian Westphal 2008-06-04 12:08:39 UTC
Created attachment 146 [details]
Add ipv4 checksum support.

Adds a static Checksum method to the ipv4 header class. Note that it only handles 20 byte ipv4 headers.
Comment 2 Florian Westphal 2008-06-04 19:17:33 UTC
Created attachment 147 [details]
Add ipv4 header checksum support.

Essentially the same as the previous version, but this one will handle an ipv4 header with options, too.

I tried to re-use src/internet-node/ipv4-checksum.cc, but first
moving the header data from Buffer::Iterator to a temporary copy
so it can be fed to the existing code is almost as much code as
doing the checksumming right away.
Comment 3 Mathieu Lacage 2008-06-04 19:52:18 UTC
looks good to me. can commit as-is.
Comment 4 Tom Henderson 2008-06-04 22:33:36 UTC
there's also this line in the header file that needs fixed:
   * \brief Enable checksum calculation for IP (XXX currently has no effect)


also, should this m_calcChecksum value be integrated into the attribute system?
Comment 5 Mathieu Lacage 2008-06-04 23:21:56 UTC
(In reply to comment #4)

> also, should this m_calcChecksum value be integrated into the attribute system?

One way to integrate this in the attribute system would be to move this variable to the Ipv4L3Protocol object and make Ipv4Header::m_calcChecksum a non-static variable and set it based on the Ipv4L3Protocol::m_calcChecksum value.
Comment 6 Mathieu Lacage 2008-06-05 18:56:30 UTC
changeset: aabbcb2cba71