Skip to content

Commit

Permalink
tcp: constify tcp_v{4|6}_route_req() sock argument
Browse files Browse the repository at this point in the history
These functions do not change the listener socket.
Goal is to make sure tcp_conn_request() is not messing with
listener in a racy way.

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 Sep 29, 2015
1 parent 3f684b4 commit f964629
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ struct tcp_request_sock_ops {
__u32 (*cookie_init_seq)(const struct sk_buff *skb,
__u16 *mss);
#endif
struct dst_entry *(*route_req)(struct sock *sk, struct flowi *fl,
struct dst_entry *(*route_req)(const struct sock *sk, struct flowi *fl,
const struct request_sock *req,
bool *strict);
__u32 (*init_seq)(const struct sk_buff *skb);
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,8 @@ static void tcp_v4_init_req(struct request_sock *req,
ireq->opt = tcp_v4_save_options(skb);
}

static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl,
static struct dst_entry *tcp_v4_route_req(const struct sock *sk,
struct flowi *fl,
const struct request_sock *req,
bool *strict)
{
Expand Down
3 changes: 2 additions & 1 deletion net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ static void tcp_v6_init_req(struct request_sock *req,
}
}

static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl,
static struct dst_entry *tcp_v6_route_req(const struct sock *sk,
struct flowi *fl,
const struct request_sock *req,
bool *strict)
{
Expand Down

0 comments on commit f964629

Please sign in to comment.