aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/request_sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-10-02 14:43:27 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-03 07:32:38 -0400
commitb267cdd1075d28501b7c05c7aeb8466775505e8d (patch)
treeb0db78ccc7e054be2e4f610db4a5f0aeb9b2213f /include/net/request_sock.h
parent38cb52455c2c3e8b5751350a3fb32e43e82e129a (diff)
tcp/dccp: init sk_prot and call sk_node_init() in reqsk_alloc()
We plan to use generic functions to insert request sockets into ehash table. sk_prot needs to be set (to retrieve sk_prot->h.hashinfo) sk_node needs to be cleared. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/request_sock.h')
-rw-r--r--include/net/request_sock.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 273fb7235ce3..97c1ba61ed2d 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -69,6 +69,16 @@ struct request_sock {
69 u32 peer_secid; 69 u32 peer_secid;
70}; 70};
71 71
72static inline struct request_sock *inet_reqsk(struct sock *sk)
73{
74 return (struct request_sock *)sk;
75}
76
77static inline struct sock *req_to_sk(struct request_sock *req)
78{
79 return (struct sock *)req;
80}
81
72static inline struct request_sock * 82static inline struct request_sock *
73reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener) 83reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
74{ 84{
@@ -78,6 +88,8 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
78 req->rsk_ops = ops; 88 req->rsk_ops = ops;
79 sock_hold(sk_listener); 89 sock_hold(sk_listener);
80 req->rsk_listener = sk_listener; 90 req->rsk_listener = sk_listener;
91 req_to_sk(req)->sk_prot = sk_listener->sk_prot;
92 sk_node_init(&req_to_sk(req)->sk_node);
81 req->saved_syn = NULL; 93 req->saved_syn = NULL;
82 /* Following is temporary. It is coupled with debugging 94 /* Following is temporary. It is coupled with debugging
83 * helpers in reqsk_put() & reqsk_free() 95 * helpers in reqsk_put() & reqsk_free()
@@ -87,16 +99,6 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
87 return req; 99 return req;
88} 100}
89 101
90static inline struct request_sock *inet_reqsk(struct sock *sk)
91{
92 return (struct request_sock *)sk;
93}
94
95static inline struct sock *req_to_sk(struct request_sock *req)
96{
97 return (struct sock *)req;
98}
99
100static inline void reqsk_free(struct request_sock *req) 102static inline void reqsk_free(struct request_sock *req)
101{ 103{
102 /* temporary debugging */ 104 /* temporary debugging */