hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/include/net/request_sock.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * NET Generic infrastructure for Network protocols.
34 *
....@@ -6,11 +7,6 @@
67 * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
78 *
89 * From code originally in include/net/tcp.h
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.
1410 */
1511 #ifndef _REQUEST_SOCK_H
1612 #define _REQUEST_SOCK_H
....@@ -45,6 +41,13 @@
4541
4642 int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req);
4743
44
+struct saved_syn {
45
+ u32 mac_hdrlen;
46
+ u32 network_hdrlen;
47
+ u32 tcp_hdrlen;
48
+ u8 data[];
49
+};
50
+
4851 /* struct request_sock - mini sock to represent a connection request
4952 */
5053 struct request_sock {
....@@ -58,13 +61,13 @@
5861 struct request_sock *dl_next;
5962 u16 mss;
6063 u8 num_retrans; /* number of retransmits */
61
- u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
64
+ u8 syncookie:1; /* syncookie: encode tcpopts in timestamp */
6265 u8 num_timeout:7; /* number of timeouts */
6366 u32 ts_recent;
6467 struct timer_list rsk_timer;
6568 const struct request_sock_ops *rsk_ops;
6669 struct sock *sk;
67
- u32 *saved_syn;
70
+ struct saved_syn *saved_syn;
6871 u32 secid;
6972 u32 peer_secid;
7073 };
....@@ -101,16 +104,16 @@
101104 sk_node_init(&req_to_sk(req)->sk_node);
102105 sk_tx_queue_clear(req_to_sk(req));
103106 req->saved_syn = NULL;
107
+ req->num_timeout = 0;
108
+ req->num_retrans = 0;
109
+ req->sk = NULL;
104110 refcount_set(&req->rsk_refcnt, 0);
105111
106112 return req;
107113 }
108114
109
-static inline void reqsk_free(struct request_sock *req)
115
+static inline void __reqsk_free(struct request_sock *req)
110116 {
111
- /* temporary debugging */
112
- WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0);
113
-
114117 req->rsk_ops->destructor(req);
115118 if (req->rsk_listener)
116119 sock_put(req->rsk_listener);
....@@ -118,6 +121,12 @@
118121 kmem_cache_free(req->rsk_ops->slab, req);
119122 }
120123
124
+static inline void reqsk_free(struct request_sock *req)
125
+{
126
+ WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0);
127
+ __reqsk_free(req);
128
+}
129
+
121130 static inline void reqsk_put(struct request_sock *req)
122131 {
123132 if (refcount_dec_and_test(&req->rsk_refcnt))