aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2014-09-01 14:04:51 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2014-09-01 14:04:51 +0000
commitc26544aa7f9234a4c0e5363f5bdfe926f0b910d8 (patch)
treee39da6f40dcaa268764de6c04e21962652d4f5ee /sys/netinet/raw_ip.c
parentb616ae250cdb7c962de544717143ca71ba5716e9 (diff)
Notes
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 99706312db0f1..f394f01d9a587 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -290,11 +290,6 @@ rip_input(struct mbuf **mp, int *offp, int proto)
last = NULL;
ifp = m->m_pkthdr.rcvif;
- /*
- * Applications on raw sockets expect host byte order.
- */
- ip->ip_len = ntohs(ip->ip_len);
- ip->ip_off = ntohs(ip->ip_off);
hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask);
@@ -504,8 +499,8 @@ rip_output(struct mbuf *m, struct socket *so, ...)
* and don't allow packet length sizes that will crash.
*/
if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options)
- || (ip->ip_len > m->m_pkthdr.len)
- || (ip->ip_len < (ip->ip_hl << 2))) {
+ || (ntohs(ip->ip_len) > m->m_pkthdr.len)
+ || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) {
INP_RUNLOCK(inp);
m_freem(m);
return (EINVAL);
@@ -514,13 +509,6 @@ rip_output(struct mbuf *m, struct socket *so, ...)
ip->ip_id = ip_newid();
/*
- * Applications on raw sockets pass us packets
- * in host byte order.
- */
- ip->ip_len = htons(ip->ip_len);
- ip->ip_off = htons(ip->ip_off);
-
- /*
* XXX prevent ip_output from overwriting header fields.
*/
flags |= IP_RAWOUTPUT;