Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Recalculating IPv4 checksum: (4 Items)
   
Recalculating IPv4 checksum  
I'm working on an IP driver, mounted in io-net with the full TCP/IP stack, under QNX 6.3.2.  If I need to update a piece
 of a packet on its way through my driver, how should I recalculate the IP checksum?

I've read up on RFC 1071, dealing with calculating IP checksums, but if the stack already provides a way to update it 
for me, then I would rather use that then write one of my own.  Since updating the TTL is something that should be done 
on every hop, I was surprised when I couldn't find anything on it when searching the QNX/Foundry27 sites.  Perhaps this 
is typically only done by the stack and not by the drivers... but is there a way for a driver to do it?
RE: Recalculating IPv4 checksum  
> update a piece of a packet 

IIRC you only need to update the IP header checksum
if you are altering part of the IP header.

--
aboyd
Re: Recalculating IPv4 checksum  
On Mon, Feb 02, 2009 at 10:15:18AM -0500, Jonathan Langen wrote:
> I'm working on an IP driver, mounted in io-net with the full TCP/IP stack, under QNX 6.3.2.  If I need to update a 
piece of a packet on its way through my driver, how should I recalculate the IP checksum?
> 
> I've read up on RFC 1071, dealing with calculating IP checksums, but if the stack already provides a way to update it 
for me, then I would rather use that then write one of my own.  Since updating the TTL is something that should be done 
on every hop, I was surprised when I couldn't find anything on it when searching the QNX/Foundry27 sites.  Perhaps this 
is typically only done by the stack and not by the drivers... but is there a way for a driver to do it?

Grep for IPTTLDEC (which is defined to 1) in the ipflow source.

-seanb

http://community.qnx.com/integration/viewcvs/viewcvs.cgi/*checkout*/trunk/sys/netinet/ip_flow.c?root=core_networking&rev
=480&system=exsy1001
Re: Recalculating IPv4 checksum  
> Grep for IPTTLDEC (which is defined to 1) in the ipflow source.
> 
> -seanb
> 
> http://community.qnx.com/integration/viewcvs/viewcvs.cgi/*checkout*/trunk/sys/
> netinet/ip_flow.c?root=core_networking&rev=480&system=exsy1001


So there's no function or macro to call, which is what I was expecting, but the algorithm is simple enough so I'll just 
copy/paste it.

Thanks!