Index: sys/netinet/tcp_input.c =================================================================== RCS file: /cvsroot/src/sys/netinet/tcp_input.c,v retrieving revision 1.347 diff -p -u -r1.347 tcp_input.c --- sys/netinet/tcp_input.c 10 Jun 2016 13:31:44 -0000 1.347 +++ sys/netinet/tcp_input.c 6 Nov 2016 09:57:25 -0000 @@ -1346,7 +1346,16 @@ tcp_input(struct mbuf *m, ...) m_freem(m); return; } - + if (TCP_HDR_ALIGNED_P(th) == 0) { + m = m_copyup(m, toff + sizeof(struct tcphdr), 0); + if (m == NULL) { + TCP_STATINC(TCP_STAT_RCVSHORT); + return; + } + ip = mtod(m, struct ip *); + ip6 = mtod(m, struct ip6_hdr *); + th = (struct tcphdr *)(mtod(m, char *) + toff); + } KASSERT(TCP_HDR_ALIGNED_P(th)); /* Index: sys/netinet/udp_usrreq.c =================================================================== RCS file: /cvsroot/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.227 diff -p -u -r1.227 udp_usrreq.c --- sys/netinet/udp_usrreq.c 19 Oct 2016 01:13:01 -0000 1.227 +++ sys/netinet/udp_usrreq.c 6 Nov 2016 09:57:25 -0000 @@ -355,6 +355,15 @@ udp_input(struct mbuf *m, ...) UDP_STATINC(UDP_STAT_HDROPS); return; } + if (UDP_HDR_ALIGNED_P(uh) == 0) { + m = m_copyup(m, iphlen + sizeof(struct udphdr), 0); + if (m == NULL) { + UDP_STATINC(UDP_STAT_HDROPS); + return; + } + ip = mtod(m, struct ip *); + uh = (struct udphdr *)(mtod(m, char *) + iphlen); + } KASSERT(UDP_HDR_ALIGNED_P(uh)); /* destination port of 0 is illegal, based on RFC768. */ Index: sys/netinet6/icmp6.c =================================================================== RCS file: /cvsroot/src/sys/netinet6/icmp6.c,v retrieving revision 1.199 diff -p -u -r1.199 icmp6.c --- sys/netinet6/icmp6.c 25 Oct 2016 02:45:10 -0000 1.199 +++ sys/netinet6/icmp6.c 6 Nov 2016 09:57:27 -0000 @@ -482,6 +482,16 @@ icmp6_input(struct mbuf **mp, int *offp, icmp6_ifstat_inc(rcvif, ifs6_in_error); goto freeit; } + if (IP6_HDR_ALIGNED_P(icmp6) == 0) { + m = m_copyup(m, off + sizeof(struct icmp6_hdr), 0); + if (m == NULL) { + ICMP6_STATINC(ICMP6_STAT_TOOSHORT); + icmp6_ifstat_inc(rcvif, ifs6_in_error); + goto freeit; + } + ip6 = mtod(m, struct ip6_hdr *); + icmp6 = (struct icmp6_hdr *)(ip6 + 1); + } KASSERT(IP6_HDR_ALIGNED_P(icmp6)); /* Index: sys/netinet6/udp6_usrreq.c =================================================================== RCS file: /cvsroot/src/sys/netinet6/udp6_usrreq.c,v retrieving revision 1.124 diff -p -u -r1.124 udp6_usrreq.c --- sys/netinet6/udp6_usrreq.c 15 Jul 2016 07:40:09 -0000 1.124 +++ sys/netinet6/udp6_usrreq.c 6 Nov 2016 09:57:27 -0000 @@ -581,6 +581,15 @@ udp6_input(struct mbuf **mp, int *offp, IP6_STATINC(IP6_STAT_TOOSHORT); return IPPROTO_DONE; } + if (UDP_HDR_ALIGNED_P(uh) == 0) { + m = m_copyup(m, off + sizeof(struct udphdr), 0); + if (m == NULL) { + IP6_STATINC(IP6_STAT_TOOSHORT); + return IPPROTO_DONE; + } + ip6 = mtod(m, struct ip6_hdr *); + uh = (struct udphdr *)(mtod(m, char *) + off); + } KASSERT(UDP_HDR_ALIGNED_P(uh)); ulen = ntohs((u_short)uh->uh_ulen); /*