tcp: cleanup

No functional change intended.

Reviewed by:		pouria, rrs, Timo Völker
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D55415
This commit is contained in:
Michael Tuexen committed 2026-02-22 18:44:10 +01:00
1 parent 7755a406a6
commit c984c7593e
1 file changed
+12 -12
+12 -12
View File
@@ -582,13 +582,14 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
if ((m->m_flags & M_PKTHDR) == 0) {
/* Can't handle one that is not a pkt hdr */
TCPSTAT_INC(tcps_tunneled_errs);
goto out;
m_freem(m);
return (true);
}
thlen = sizeof(struct tcphdr);
if (m->m_len < off + sizeof(struct udphdr) + thlen &&
(m = m_pullup(m, off + sizeof(struct udphdr) + thlen)) == NULL) {
TCPSTAT_INC(tcps_tunneled_errs);
goto out;
return (true);
}
iph = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)iph + off);
@@ -598,7 +599,7 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
m = m_pullup(m, off + sizeof(struct udphdr) + thlen);
if (m == NULL) {
TCPSTAT_INC(tcps_tunneled_errs);
goto out;
return (true);
} else {
iph = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)iph + off);
@@ -620,9 +621,10 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
#ifdef INET
case IPVERSION:
len = ntohs(iph->ip_len) - sizeof(struct udphdr);
if (len != m->m_pkthdr.len) {
if (__predict_false(len != m->m_pkthdr.len)) {
TCPSTAT_INC(tcps_tunneled_errs);
goto out;
m_freem(m);
return (true);
} else {
iph->ip_len = htons(len);
tcp_input_with_port(&m, &off, IPPROTO_TCP, port);
@@ -633,9 +635,11 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
case IPV6_VERSION >> 4:
ip6 = mtod(m, struct ip6_hdr *);
len = ntohs(ip6->ip6_plen) - sizeof(struct udphdr);
if (len + sizeof(struct ip6_hdr) != m->m_pkthdr.len) {
if (__predict_false(len + sizeof(struct ip6_hdr) !=
m->m_pkthdr.len)) {
TCPSTAT_INC(tcps_tunneled_errs);
goto out;
m_freem(m);
return (true);
} else {
ip6->ip6_plen = htons(len);
tcp6_input_with_port(&m, &off, IPPROTO_TCP, port);
@@ -643,13 +647,9 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
break;
#endif
default:
goto out;
m_freem(m);
break;
}
return (true);
out:
m_freem(m);
return (true);
}