Commit 3f66b083 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

inet: introduce ireq_family

Before inserting request socks into general hash table,
fill their socket family.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4f06873
...@@ -82,6 +82,7 @@ struct inet_request_sock { ...@@ -82,6 +82,7 @@ struct inet_request_sock {
#define ireq_net req.__req_common.skc_net #define ireq_net req.__req_common.skc_net
#define ireq_state req.__req_common.skc_state #define ireq_state req.__req_common.skc_state
#define ireq_refcnt req.__req_common.skc_refcnt #define ireq_refcnt req.__req_common.skc_refcnt
#define ireq_family req.__req_common.skc_family
kmemcheck_bitfield_begin(flags); kmemcheck_bitfield_begin(flags);
u16 snd_wscale : 4, u16 snd_wscale : 4,
......
...@@ -642,6 +642,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -642,6 +642,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
ireq->ir_loc_addr = ip_hdr(skb)->daddr; ireq->ir_loc_addr = ip_hdr(skb)->daddr;
ireq->ir_rmt_addr = ip_hdr(skb)->saddr; ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
write_pnet(&ireq->ireq_net, sock_net(sk)); write_pnet(&ireq->ireq_net, sock_net(sk));
ireq->ireq_family = AF_INET;
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
......
...@@ -404,6 +404,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -404,6 +404,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
write_pnet(&ireq->ireq_net, sock_net(sk)); write_pnet(&ireq->ireq_net, sock_net(sk));
ireq->ireq_family = AF_INET6;
if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) || if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) ||
np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
......
...@@ -728,7 +728,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, ...@@ -728,7 +728,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
return -EMSGSIZE; return -EMSGSIZE;
r = nlmsg_data(nlh); r = nlmsg_data(nlh);
r->idiag_family = sk->sk_family; r->idiag_family = ireq->ireq_family;
r->idiag_state = TCP_SYN_RECV; r->idiag_state = TCP_SYN_RECV;
r->idiag_timer = 1; r->idiag_timer = 1;
r->idiag_retrans = req->num_retrans; r->idiag_retrans = req->num_retrans;
......
...@@ -347,6 +347,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) ...@@ -347,6 +347,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
treq->snt_synack = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0; treq->snt_synack = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0;
treq->listener = NULL; treq->listener = NULL;
write_pnet(&ireq->ireq_net, sock_net(sk)); write_pnet(&ireq->ireq_net, sock_net(sk));
ireq->ireq_family = AF_INET;
/* We throwed the options of the initial SYN away, so we hope /* We throwed the options of the initial SYN away, so we hope
* the ACK carries the same options again (see RFC1122 4.2.3.8) * the ACK carries the same options again (see RFC1122 4.2.3.8)
......
...@@ -1228,6 +1228,7 @@ static void tcp_v4_init_req(struct request_sock *req, struct sock *sk, ...@@ -1228,6 +1228,7 @@ static void tcp_v4_init_req(struct request_sock *req, struct sock *sk,
ireq->ir_rmt_addr = ip_hdr(skb)->saddr; ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
ireq->no_srccheck = inet_sk(sk)->transparent; ireq->no_srccheck = inet_sk(sk)->transparent;
ireq->opt = tcp_v4_save_options(skb); ireq->opt = tcp_v4_save_options(skb);
ireq->ireq_family = AF_INET;
} }
static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl, static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl,
......
...@@ -197,6 +197,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) ...@@ -197,6 +197,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
treq = tcp_rsk(req); treq = tcp_rsk(req);
treq->listener = NULL; treq->listener = NULL;
write_pnet(&ireq->ireq_net, sock_net(sk)); write_pnet(&ireq->ireq_net, sock_net(sk));
ireq->ireq_family = AF_INET6;
if (security_inet_conn_request(sk, skb, req)) if (security_inet_conn_request(sk, skb, req))
goto out_free; goto out_free;
......
...@@ -749,6 +749,7 @@ static void tcp_v6_init_req(struct request_sock *req, struct sock *sk, ...@@ -749,6 +749,7 @@ static void tcp_v6_init_req(struct request_sock *req, struct sock *sk,
atomic_inc(&skb->users); atomic_inc(&skb->users);
ireq->pktopts = skb; ireq->pktopts = skb;
} }
ireq->ireq_family = AF_INET6;
} }
static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl, static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment