hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/ipv6/syncookies.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * IPv6 Syncookies implementation for the Linux kernel
34 *
....@@ -6,12 +7,6 @@
67 *
78 * Based on IPv4 implementation by Andi Kleen
89 * 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
- *
1510 */
1611
1712 #include <linux/tcp.h>
....@@ -146,7 +141,8 @@
146141 __u8 rcv_wscale;
147142 u32 tsoff = 0;
148143
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)
150146 goto out;
151147
152148 if (tcp_synq_no_recent_overflow(sk))
....@@ -175,7 +171,8 @@
175171 goto out;
176172
177173 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);
179176 if (!req)
180177 goto out;
181178
....@@ -238,7 +235,7 @@
238235 fl6.fl6_dport = ireq->ir_rmt_port;
239236 fl6.fl6_sport = inet_sk(sk)->inet_sport;
240237 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));
242239
243240 dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
244241 if (IS_ERR(dst))