Date: Fri, 21 May 2021 08:31:36 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 500eb6dd8040 - main - tcp: Fix sending of TCP segments with IP level options Message-ID: <202105210831.14L8Va9P000641@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=500eb6dd80404ea512e31a8f795c73cb802c9c64 commit 500eb6dd80404ea512e31a8f795c73cb802c9c64 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-05-21 07:45:00 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-05-21 07:49:45 +0000 tcp: Fix sending of TCP segments with IP level options When bringing in TCP over UDP support in https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605, the length of IP level options was considered when locating the transport header. This was incorrect and is fixed by this patch. X-MFC with: https://cgit.FreeBSD.org/src/commit/?id=9e644c23000c2f5028b235f6263d17ffb24d3605 MFC after: 3 days Reviewed by: markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D30358 --- sys/netinet/tcp_output.c | 4 ++-- sys/netinet/tcp_stacks/bbr.c | 4 ++-- sys/netinet/tcp_stacks/rack.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 20b9c0371122..93c376f81f1a 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1154,7 +1154,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -1172,7 +1172,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip); diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index af6c9462c8e0..22762d21c289 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -13354,7 +13354,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -13372,7 +13372,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip); diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index c4f3be02dd29..73b47745cbac 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -17658,7 +17658,7 @@ send: if (isipv6) { ip6 = mtod(m, struct ip6_hdr *); if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip6 + ipoptlen + sizeof(struct ip6_hdr)); + udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip6_hdr); @@ -17675,7 +17675,7 @@ send: ipov = (struct ipovly *)ip; #endif if (tp->t_port) { - udp = (struct udphdr *)((caddr_t)ip + ipoptlen + sizeof(struct ip)); + udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip)); udp->uh_sport = htons(V_tcp_udp_tunneling_port); udp->uh_dport = tp->t_port; ulen = hdrlen + len - sizeof(struct ip);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105210831.14L8Va9P000641>