.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * NET Generic infrastructure for Network protocols. |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
---|
7 | 8 | * |
---|
8 | 9 | * 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. |
---|
14 | 10 | */ |
---|
15 | 11 | #ifndef _REQUEST_SOCK_H |
---|
16 | 12 | #define _REQUEST_SOCK_H |
---|
.. | .. |
---|
45 | 41 | |
---|
46 | 42 | int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req); |
---|
47 | 43 | |
---|
| 44 | +struct saved_syn { |
---|
| 45 | + u32 mac_hdrlen; |
---|
| 46 | + u32 network_hdrlen; |
---|
| 47 | + u32 tcp_hdrlen; |
---|
| 48 | + u8 data[]; |
---|
| 49 | +}; |
---|
| 50 | + |
---|
48 | 51 | /* struct request_sock - mini sock to represent a connection request |
---|
49 | 52 | */ |
---|
50 | 53 | struct request_sock { |
---|
.. | .. |
---|
58 | 61 | struct request_sock *dl_next; |
---|
59 | 62 | u16 mss; |
---|
60 | 63 | 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 */ |
---|
62 | 65 | u8 num_timeout:7; /* number of timeouts */ |
---|
63 | 66 | u32 ts_recent; |
---|
64 | 67 | struct timer_list rsk_timer; |
---|
65 | 68 | const struct request_sock_ops *rsk_ops; |
---|
66 | 69 | struct sock *sk; |
---|
67 | | - u32 *saved_syn; |
---|
| 70 | + struct saved_syn *saved_syn; |
---|
68 | 71 | u32 secid; |
---|
69 | 72 | u32 peer_secid; |
---|
70 | 73 | }; |
---|
.. | .. |
---|
101 | 104 | sk_node_init(&req_to_sk(req)->sk_node); |
---|
102 | 105 | sk_tx_queue_clear(req_to_sk(req)); |
---|
103 | 106 | req->saved_syn = NULL; |
---|
| 107 | + req->num_timeout = 0; |
---|
| 108 | + req->num_retrans = 0; |
---|
| 109 | + req->sk = NULL; |
---|
104 | 110 | refcount_set(&req->rsk_refcnt, 0); |
---|
105 | 111 | |
---|
106 | 112 | return req; |
---|
107 | 113 | } |
---|
108 | 114 | |
---|
109 | | -static inline void reqsk_free(struct request_sock *req) |
---|
| 115 | +static inline void __reqsk_free(struct request_sock *req) |
---|
110 | 116 | { |
---|
111 | | - /* temporary debugging */ |
---|
112 | | - WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); |
---|
113 | | - |
---|
114 | 117 | req->rsk_ops->destructor(req); |
---|
115 | 118 | if (req->rsk_listener) |
---|
116 | 119 | sock_put(req->rsk_listener); |
---|
.. | .. |
---|
118 | 121 | kmem_cache_free(req->rsk_ops->slab, req); |
---|
119 | 122 | } |
---|
120 | 123 | |
---|
| 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 | + |
---|
121 | 130 | static inline void reqsk_put(struct request_sock *req) |
---|
122 | 131 | { |
---|
123 | 132 | if (refcount_dec_and_test(&req->rsk_refcnt)) |
---|