Skip to content

Commit

Permalink
tcp/dccp: init sk_prot and call sk_node_init() in reqsk_alloc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 3, 2015
1 parent 38cb524 commit b267cdd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions include/net/request_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ struct request_sock {
u32 peer_secid;
};

static inline struct request_sock *inet_reqsk(struct sock *sk)
{
return (struct request_sock *)sk;
}

static inline struct sock *req_to_sk(struct request_sock *req)
{
return (struct sock *)req;
}

static inline struct request_sock *
reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
{
Expand All @@ -78,6 +88,8 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
req->rsk_ops = ops;
sock_hold(sk_listener);
req->rsk_listener = sk_listener;
req_to_sk(req)->sk_prot = sk_listener->sk_prot;
sk_node_init(&req_to_sk(req)->sk_node);
req->saved_syn = NULL;
/* Following is temporary. It is coupled with debugging
* helpers in reqsk_put() & reqsk_free()
Expand All @@ -87,16 +99,6 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
return req;
}

static inline struct request_sock *inet_reqsk(struct sock *sk)
{
return (struct request_sock *)sk;
}

static inline struct sock *req_to_sk(struct request_sock *req)
{
return (struct sock *)req;
}

static inline void reqsk_free(struct request_sock *req)
{
/* temporary debugging */
Expand Down

0 comments on commit b267cdd

Please sign in to comment.