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
This commit is contained in:
parent
8dc96b74ed
commit
500eb6dd80
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user