aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/inet_sock.h24
-rw-r--r--net/ipv4/tcp_input.c24
2 files changed, 26 insertions, 22 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index cf7abb00941b..6fec7343070f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -244,28 +244,8 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr,
244 initval); 244 initval);
245} 245}
246 246
247static inline struct request_sock * 247struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
248inet_reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener) 248 struct sock *sk_listener);
249{
250 struct request_sock *req = reqsk_alloc(ops);
251
252 if (req) {
253 struct inet_request_sock *ireq = inet_rsk(req);
254
255 kmemcheck_annotate_bitfield(ireq, flags);
256 ireq->opt = NULL;
257 atomic64_set(&ireq->ir_cookie, 0);
258 ireq->ireq_state = TCP_NEW_SYN_RECV;
259 write_pnet(&ireq->ireq_net, sock_net(sk_listener));
260
261 /* Following is temporary. It is coupled with debugging
262 * helpers in reqsk_put() & reqsk_free()
263 */
264 atomic_set(&ireq->ireq_refcnt, 0);
265 }
266
267 return req;
268}
269 249
270static inline __u8 inet_sk_flowi_flags(const struct sock *sk) 250static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
271{ 251{
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2a480f6811ea..52b74e0eab2a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5967,6 +5967,30 @@ static void tcp_openreq_init(struct request_sock *req,
5967 ireq->ir_mark = inet_request_mark(sk, skb); 5967 ireq->ir_mark = inet_request_mark(sk, skb);
5968} 5968}
5969 5969
5970struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
5971 struct sock *sk_listener)
5972{
5973 struct request_sock *req = reqsk_alloc(ops);
5974
5975 if (req) {
5976 struct inet_request_sock *ireq = inet_rsk(req);
5977
5978 kmemcheck_annotate_bitfield(ireq, flags);
5979 ireq->opt = NULL;
5980 atomic64_set(&ireq->ir_cookie, 0);
5981 ireq->ireq_state = TCP_NEW_SYN_RECV;
5982 write_pnet(&ireq->ireq_net, sock_net(sk_listener));
5983
5984 /* Following is temporary. It is coupled with debugging
5985 * helpers in reqsk_put() & reqsk_free()
5986 */
5987 atomic_set(&ireq->ireq_refcnt, 0);
5988 }
5989
5990 return req;
5991}
5992EXPORT_SYMBOL(inet_reqsk_alloc);
5993
5970int tcp_conn_request(struct request_sock_ops *rsk_ops, 5994int tcp_conn_request(struct request_sock_ops *rsk_ops,
5971 const struct tcp_request_sock_ops *af_ops, 5995 const struct tcp_request_sock_ops *af_ops,
5972 struct sock *sk, struct sk_buff *skb) 5996 struct sock *sk, struct sk_buff *skb)