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>
This commit is contained in:

committed by
David S. Miller

parent
9f2dbdd9b1
commit
407640de21
@@ -244,16 +244,19 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr,
|
||||
initval);
|
||||
}
|
||||
|
||||
static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
|
||||
static inline struct request_sock *
|
||||
inet_reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
|
||||
{
|
||||
struct request_sock *req = reqsk_alloc(ops);
|
||||
struct inet_request_sock *ireq = inet_rsk(req);
|
||||
|
||||
if (req != NULL) {
|
||||
if (req) {
|
||||
struct inet_request_sock *ireq = inet_rsk(req);
|
||||
|
||||
kmemcheck_annotate_bitfield(ireq, flags);
|
||||
ireq->opt = NULL;
|
||||
atomic64_set(&ireq->ir_cookie, 0);
|
||||
ireq->ireq_state = TCP_NEW_SYN_RECV;
|
||||
write_pnet(&ireq->ireq_net, sock_net(sk_listener));
|
||||
|
||||
/* Following is temporary. It is coupled with debugging
|
||||
* helpers in reqsk_put() & reqsk_free()
|
||||
|
Reference in New Issue
Block a user