IP6_EXTHDR_CHECK(): remove the last instances

While r354748 removed almost all IP6_EXTHDR_CHECK() calls, these
are not part of the PULLDOWN_TESTS.
Equally convert these IP6_EXTHDR_CHECK()s here to m_pullup() and remove
the extra check and m_pullup() in tcp_input() under isipv6 given
tcp6_input() has done exactly that pullup already.

MFC after:	8 weeks
Sponsored by:	Netflix
This commit is contained in:
Bjoern A. Zeeb 2019-11-15 21:51:43 +00:00
parent 63abacc204
commit 4e619b17c5

View File

@ -517,7 +517,12 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
struct ip6_hdr *ip6;
m = *mp;
IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE);
m = m_pullup(m, *offp + sizeof(struct tcphdr));
if (m == NULL) {
*mp = m;
TCPSTAT_INC(tcps_rcvshort);
return (IPPROTO_DONE);
}
/*
* draft-itojun-ipv6-tcp-to-anycast
@ -595,15 +600,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
#ifdef INET6
if (isipv6) {
/* IP6_EXTHDR_CHECK() is already done at tcp6_input(). */
if (m->m_len < (sizeof(*ip6) + sizeof(*th))) {
m = m_pullup(m, sizeof(*ip6) + sizeof(*th));
if (m == NULL) {
TCPSTAT_INC(tcps_rcvshort);
return (IPPROTO_DONE);
}
}
ip6 = mtod(m, struct ip6_hdr *);
th = (struct tcphdr *)((caddr_t)ip6 + off0);
@ -712,7 +708,11 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
if (off > sizeof (struct tcphdr)) {
#ifdef INET6
if (isipv6) {
IP6_EXTHDR_CHECK(m, off0, off, IPPROTO_DONE);
m = m_pullup(m, off0 + off);
if (m == NULL) {
TCPSTAT_INC(tcps_rcvshort);
return (IPPROTO_DONE);
}
ip6 = mtod(m, struct ip6_hdr *);
th = (struct tcphdr *)((caddr_t)ip6 + off0);
}