On Thu, Oct 11, 2012 at 06:07:12AM +0400, Maxim Dounin wrote:
M> > This is de facto standard for raw sockets in most OS-es. Byte order
M> > in raw socket is host. And this is the same behavior we had before
M> > the patch. So no reason for extra comments.
M> 
M> As I already pointed out (in an off-list message), many consider 
M> this as a "known bug" in many OSes instead.
M> 
M> E.g. here is a quote from /usr/ports/net/openospfd/files/patch-ospfd_packet.c
M> patch:
M> 
M> @@ -70,7 +70,12 @@
M>         ip_hdr.ip_v = IPVERSION;
M>         ip_hdr.ip_hl = sizeof(ip_hdr) >> 2;
M>         ip_hdr.ip_tos = IPTOS_PREC_INTERNETCONTROL;
M> +#if defined(__FreeBSD__) || defined(__NetBSD__)
M> +       /* FreeBSD/NetBSD wants the length in the native host byte order. */
M> +       ip_hdr.ip_len = len + sizeof(ip_hdr);
M> +#else
M>         ip_hdr.ip_len = htons(len + sizeof(ip_hdr));
M> +#endif
M> 
M> I would suggests it at least deserves a comment, and probably API 
M> change/fix too.

I'm okay with comment, but not changes here. At least no ABI cnahge in
context of discussed change of byte ordering inside stack.

Right now situation is the following:

OS              order           hlen strip on input
FreeBSD 9.x     host            +
FreeBSD 10      host            -
Linux           host            -
NetBSD          host            +
OpenBSD         ???[*]          -
Dragonfly       net             +

[*] According to quagga sources order in OpenBSD is host, but according to
you quote of openospfd it is net. According to raw_ip.c itself it is net.
Probably OpenBSD switched to net and since quagga isn't supported on it.

So, preserving host order keeps us in sync with older FreeBSD, NetBSD
and Linux.

-- 
Totus tuus, Glebius.
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to