Re: Question about network partial checksums
Hi Dave, On Tue, Feb 19, 2013 at 8:13 AM, dave jones <s.dave.jones@gmail.com> wrote:
How do I compute partial checksums on mbuf chains on OS X? Would you give me an exmaple? Thanks. It seems to me OS X doesn't have that API.
There are functions mbuf_inet_cksum() and mbuf_inet6_cksum() which calculate the checksum for a range of data in an mbuf: http://developer.apple.com/library/mac/documentation/Kernel/Reference/kpi_mb... The documentation isn't fantastic, so you'll probably want to look at the source code; mbuf_inet_cksum() calls inet_cksum() to do the actual work, and that's defined in bsd/netinet/in_cksum.c in the xnu source tree. However, in my virtio-net driver I seem to have ended up implementing the one's complement sum directly for the partial checksum on fragmented packets. I wrote that code 18 months ago, and I can't for the life of me remember why I didn't just use mbuf_inet_cksum(). Hope that (vaguely) helps. phil -- http://philjordan.eu/ - Phil Jordan, software development contractor _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Phil Jordan