aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/in_gif.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2012-10-22 21:09:03 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2012-10-22 21:09:03 +0000
commit8f134647ca14b930e2ab01b4192ce895127a6e02 (patch)
tree6e8c53bf2442763edea3176e3bef68bfec20a183 /sys/netinet/in_gif.c
parentcb554de22232dd60f35883efa86e9470022a4569 (diff)
downloadsrc-8f134647ca14b930e2ab01b4192ce895127a6e02.tar.gz
src-8f134647ca14b930e2ab01b4192ce895127a6e02.zip
Switch the entire IPv4 stack to keep the IP packet header
in network byte order. Any host byte order processing is done in local variables and host byte order values are never[1] written to a packet. After this change a packet processed by the stack isn't modified at all[2] except for TTL. After this change a network stack hacker doesn't need to scratch his head trying to figure out what is the byte order at the given place in the stack. [1] One exception still remains. The raw sockets convert host byte order before pass a packet to an application. Probably this would remain for ages for compatibility. [2] The ip_input() still subtructs header len from ip->ip_len, but this is planned to be fixed soon. Reviewed by: luigi, Maxim Dounin <mdounin mdounin.ru> Tested by: ray, Olivier Cochard-Labbe <olivier cochard.me>
Notes
Notes: svn path=/head/; revision=241913
Diffstat (limited to 'sys/netinet/in_gif.c')
-rw-r--r--sys/netinet/in_gif.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index 6c60390aa6a5..6ccd17f41b6e 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -192,7 +192,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m)
iphdr.ip_p = proto;
/* version will be set in ip_output() */
iphdr.ip_ttl = V_ip_gif_ttl;
- iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip);
+ iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip));
ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE,
&iphdr.ip_tos, &tos);