From: Rick Jones <[EMAIL PROTECTED]>
Date: Tue, 08 Nov 2005 13:01:52 -0800

> Endianness often makes my head spin, so please be kind - are the
> addresses being converted to little endian before the hash (ntohl as
> it were) or is it just happening as a consequence?  If the former,
> why the conversion?

We store the ports and the IP addresses in network byte order
in the socket structure members, so when we read them into
a register on little-endian systems the least significant bits
of the network ports and addresses will be in the uppermost
bits of the register.

We store them in network byte order so we can compare them
directly for equality with the values in the IP and TCP
headers.

Stacks like BSD take the road of doing endian conversions on
the packet contents themselves (which is really terrible for
minimising COW of packets for network tap sniffing), and using
native endianness for the in-socket values and comparisons.

> OK, I'll bite - Jenkins?

The Jenkins hash implemented in <linux/jenkins.h>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to