diff options
| author | Michael Tuexen <tuexen@FreeBSD.org> | 2026-02-22 17:44:10 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2026-02-22 17:44:10 +0000 |
| commit | c984c7593e11aa95f21f79bb5425a9d5e9181945 (patch) | |
| tree | 81286e0ee8c7528ce37bd60339ffca47c08a82f5 | |
| parent | 7755a406a6ae3801e885a79f714155f97c4d2bc6 (diff) | |
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
| -rw-r--r-- | sys/netinet/tcp_subr.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 6a6eef32e777..c759e9a1cd6b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -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,14 +647,10 @@ 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); } static int |
