summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2011-10-07 13:43:01 +0000
committerandre <andre@FreeBSD.org>2011-10-07 13:43:01 +0000
commit94a8deed4efbf7e2dba2eda1286d2eb18cb16440 (patch)
treeb627299eb989d4fbb9731dd210a54db884f7b072 /sys/netinet
parent2540f213459be5dab847fa75445eaf6044e92662 (diff)
downloadFreeBSD-src-94a8deed4efbf7e2dba2eda1286d2eb18cb16440.zip
FreeBSD-src-94a8deed4efbf7e2dba2eda1286d2eb18cb16440.tar.gz
Add back the IP header length to the total packet length field on
raw IP sockets. It was deducted in ip_input() in preparation for protocols interested only in the payload. On raw sockets the IP header should be delivered as it at came in from the network except for the byte order swaps in some fields. This brings us in line with all other OS'es that provide raw IP sockets. Reported by: Matthew Cini Sarreo <mcins1-at-gmail.com> MFC after: 3 days
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/raw_ip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 1a8e537..dc7d965 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -289,6 +289,13 @@ rip_input(struct mbuf *m, int off)
last = NULL;
ifp = m->m_pkthdr.rcvif;
+ /*
+ * Add back the IP header length which was
+ * removed by ip_input(). Raw sockets do
+ * not modify the packet except for some
+ * byte order swaps.
+ */
+ ip->ip_len += off;
hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask);
OpenPOWER on IntegriCloud