Hi,
I recommend this tutorial, it contains the answers to both your questions (and lots more):
http://jengelh.medozas.de/documents/...er_Modules.pdf
However, here is the solutions.
Output IP-address:
You use the macro NIPQUAD and feed it the saddr/daddr (for example NIPQUAD(iph->saddr). The matching part in your printk is ("%u.%u.%u.%u). (Found at
http://new.linuxfocus.org/English/Fe...ticle367.shtml)
Checksumming:
When changing the IP-header, you have to recalculate both IP and transport protocol checksum.
When changing the transport protocol header/payload, you only have to recalculate the transport protocol checksum.
Calculate IP-checksum:
Depending on if the value you changed was a __be16 or __be32, you use csum_replace2 and csum_replace4 respectively.
Calculating transport protocol checksum:
Depending on if the value you changed was a __be16 or __be32, you use inet_proto_csum_replace2 or inet_proto_csum_replace4 respectively
I am not sure what is the most effective way to recalculated the checksum if you have modified more then one field (these functions have to be called for every changed part).