| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * IPv6 Syncookies implementation for the Linux kernel |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Based on IPv4 implementation by Andi Kleen |
|---|
| 8 | 9 | * linux/net/ipv4/syncookies.c |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License |
|---|
| 12 | | - * as published by the Free Software Foundation; either version |
|---|
| 13 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | 10 | */ |
|---|
| 16 | 11 | |
|---|
| 17 | 12 | #include <linux/tcp.h> |
|---|
| .. | .. |
|---|
| 146 | 141 | __u8 rcv_wscale; |
|---|
| 147 | 142 | u32 tsoff = 0; |
|---|
| 148 | 143 | |
|---|
| 149 | | - if (!sock_net(sk)->ipv4.sysctl_tcp_syncookies || !th->ack || th->rst) |
|---|
| 144 | + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_syncookies) || |
|---|
| 145 | + !th->ack || th->rst) |
|---|
| 150 | 146 | goto out; |
|---|
| 151 | 147 | |
|---|
| 152 | 148 | if (tcp_synq_no_recent_overflow(sk)) |
|---|
| .. | .. |
|---|
| 175 | 171 | goto out; |
|---|
| 176 | 172 | |
|---|
| 177 | 173 | ret = NULL; |
|---|
| 178 | | - req = inet_reqsk_alloc(&tcp6_request_sock_ops, sk, false); |
|---|
| 174 | + req = cookie_tcp_reqsk_alloc(&tcp6_request_sock_ops, |
|---|
| 175 | + &tcp_request_sock_ipv6_ops, sk, skb); |
|---|
| 179 | 176 | if (!req) |
|---|
| 180 | 177 | goto out; |
|---|
| 181 | 178 | |
|---|
| .. | .. |
|---|
| 238 | 235 | fl6.fl6_dport = ireq->ir_rmt_port; |
|---|
| 239 | 236 | fl6.fl6_sport = inet_sk(sk)->inet_sport; |
|---|
| 240 | 237 | fl6.flowi6_uid = sk->sk_uid; |
|---|
| 241 | | - security_req_classify_flow(req, flowi6_to_flowi(&fl6)); |
|---|
| 238 | + security_req_classify_flow(req, flowi6_to_flowi_common(&fl6)); |
|---|
| 242 | 239 | |
|---|
| 243 | 240 | dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); |
|---|
| 244 | 241 | if (IS_ERR(dst)) |
|---|