[CFT/Review] net byte order for AF_INET

Guy Helmer guy.helmer at gmail.com
Wed Oct 10 14:47:46 UTC 2012


On Oct 9, 2012, at 10:41 AM, Gleb Smirnoff <glebius at freebsd.org> wrote:

>  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.

It's not obvious to me, so does this change the byte order expected in packets sent from userland via raw IP sockets?

Guy



More information about the freebsd-net mailing list