Re: NKEs on Intel-based Macs
Re: NKEs on Intel-based Macs
- Subject: Re: NKEs on Intel-based Macs
- From: David A Rowland <email@hidden>
- Date: Wed, 16 Aug 2006 12:45:36 -0700
Title: Re: NKEs on Intel-based Macs
At 11:33 AM -0400 8/16/06, Peter Sichel wrote:
On 8/15/06, Josh Graessley wrote:
> The problem is that mbuf_outbound_finalize calls a function
that
>expects the IP header to be in host byte order to calculate
the
>checksums (in_delayed_cksum_offset). It looks like the best
solution is
>to swap the bytes in the IP header to host byte order before
>calling mbuf_outbound_finalize and swapping them
back
>after mbuf_outbound_finalize
returns.
As I understand it the code has to do this:
err =
mbuf_pullup(mbufPtr,
12); //get the first part of the ip header in one
place
ipheaderPtr = mbuf_data(mbufPtr);
NTOHS(ipheaderPtr->ip_len);
NTOHS(ipheaderPtr->ip_id);
NTOHS(ipheaderPtr->ip_off);
mbuf_outbound_finalize(mbufPtr, AF_INET, 0);
err = mbuf_pullup(mbufPtr,
12);
ipheaderPtr = mbuf_data(mbufPtr);
HTONS(ipheaderPtr->ip_len);
HTONS(ipheaderPtr->ip_id);
HTONS(ipheaderPtr->ip_off);
HTONS(ipheaderPtr->ip_sum);
That is, put the 2-byte items in host order for mbuf_outbound_finalize and then
back in network order for transmission.
What Ron said about the checksum calculation is correct, but all
the 2-byte items, including the checksum, must agree about the order
they are in. You can't have some host and some network.
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden