[CFT/Review] net byte order for AF_INET
Gleb Smirnoff
glebius at FreeBSD.org
Tue Oct 9 15:41:37 UTC 2012
Hello,
this is a patch that switches entire IPv4 stack to network
byte order. That means, that at any layer any module should
expect IP header in network byte order. Any host byte order
values can be stored in local variables only and are never stored
into a packet itself.
The new code brings clarity, since a developer doesn't need to
know which byte order should he/she switch a packet to when
passing it to a particular function in stack. Also, any new
function introduced should expect net byte order for a packet
supplied.
The patch has been tested by me on amd64 and ray@ on mips.
TCP, UDP, ICMP, fragment reassembly and basic packet filtering
works okay.
More testing is desired, especially on boxes using some extensions
as packet filters with policy routing, running gre(4), ipsec(4),
divert(4), gif(4), multicast routing, stf(4), ng_ipfw(4), SCTP, etc.
Code reviewing also appreciated.
--
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IPv4.net-byte-order.diff
Type: text/x-diff
Size: 37680 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20121009/499cb3d0/attachment.diff>
More information about the freebsd-net
mailing list