diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-17 21:32:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-17 22:01:55 -0400 |
commit | 407640de2152e33341ce1131dac269672c3d50f7 (patch) | |
tree | dec463be332bf8e0360d495d355e90cd9b80bd26 /include/net | |
parent | 9f2dbdd9b11d40f5fe0749eb91cd1cfc86fde575 (diff) |
inet: add sk_listener argument to inet_reqsk_alloc()
listener socket can be used to set net pointer, and will
be later used to hold a reference on listener.
Add a const qualifier to first argument (struct request_sock_ops *),
and factorize all write_pnet(&ireq->ireq_net, sock_net(sk));
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/inet_sock.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index c9ed91891887..cf7abb00941b 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -244,16 +244,19 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr, | |||
244 | initval); | 244 | initval); |
245 | } | 245 | } |
246 | 246 | ||
247 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) | 247 | static inline struct request_sock * |
248 | inet_reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener) | ||
248 | { | 249 | { |
249 | struct request_sock *req = reqsk_alloc(ops); | 250 | struct request_sock *req = reqsk_alloc(ops); |
250 | struct inet_request_sock *ireq = inet_rsk(req); | ||
251 | 251 | ||
252 | if (req != NULL) { | 252 | if (req) { |
253 | struct inet_request_sock *ireq = inet_rsk(req); | ||
254 | |||
253 | kmemcheck_annotate_bitfield(ireq, flags); | 255 | kmemcheck_annotate_bitfield(ireq, flags); |
254 | ireq->opt = NULL; | 256 | ireq->opt = NULL; |
255 | atomic64_set(&ireq->ir_cookie, 0); | 257 | atomic64_set(&ireq->ir_cookie, 0); |
256 | ireq->ireq_state = TCP_NEW_SYN_RECV; | 258 | ireq->ireq_state = TCP_NEW_SYN_RECV; |
259 | write_pnet(&ireq->ireq_net, sock_net(sk_listener)); | ||
257 | 260 | ||
258 | /* Following is temporary. It is coupled with debugging | 261 | /* Following is temporary. It is coupled with debugging |
259 | * helpers in reqsk_put() & reqsk_free() | 262 | * helpers in reqsk_put() & reqsk_free() |