diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-25 00:45:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-25 00:57:48 -0400 |
commit | 0144a81cccf7532bead90f0542f517bd028d3b3c (patch) | |
tree | ee5dd135f364e5111388180183f9a4d4918b3ecb | |
parent | d631b94e7a15277858ec5f88d674d93080506999 (diff) |
tcp: fix ipv4 mapped request socks
ss should display ipv4 mapped request sockets like this :
tcp SYN-RECV 0 0 ::ffff:192.168.0.1:8080 ::ffff:192.0.2.1:35261
and not like this :
tcp SYN-RECV 0 0 192.168.0.1:8080 192.0.2.1:35261
We should init ireq->ireq_family based on listener sk_family,
not the actual protocol carried by SYN packet.
This means we can set ireq_family in inet_reqsk_alloc()
Fixes: 3f66b083a5b7 ("inet: introduce ireq_family")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/syncookies.c | 1 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 1 | ||||
-rw-r--r-- | net/ipv6/syncookies.c | 1 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 1 |
5 files changed, 1 insertions, 5 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 805dc444741d..df849e5a10f1 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -347,7 +347,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) | |||
347 | req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0; | 347 | req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0; |
348 | treq->snt_synack = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0; | 348 | treq->snt_synack = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsecr : 0; |
349 | treq->tfo_listener = false; | 349 | treq->tfo_listener = false; |
350 | ireq->ireq_family = AF_INET; | ||
351 | 350 | ||
352 | ireq->ir_iif = sk->sk_bound_dev_if; | 351 | ireq->ir_iif = sk->sk_bound_dev_if; |
353 | 352 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 95caea707f54..023196f7ec37 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5980,7 +5980,7 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, | |||
5980 | atomic64_set(&ireq->ir_cookie, 0); | 5980 | atomic64_set(&ireq->ir_cookie, 0); |
5981 | ireq->ireq_state = TCP_NEW_SYN_RECV; | 5981 | ireq->ireq_state = TCP_NEW_SYN_RECV; |
5982 | write_pnet(&ireq->ireq_net, sock_net(sk_listener)); | 5982 | write_pnet(&ireq->ireq_net, sock_net(sk_listener)); |
5983 | 5983 | ireq->ireq_family = sk_listener->sk_family; | |
5984 | } | 5984 | } |
5985 | 5985 | ||
5986 | return req; | 5986 | return req; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index fc8995a702a6..e073517b2cc7 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1206,7 +1206,6 @@ static void tcp_v4_init_req(struct request_sock *req, struct sock *sk_listener, | |||
1206 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); | 1206 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); |
1207 | ireq->no_srccheck = inet_sk(sk_listener)->transparent; | 1207 | ireq->no_srccheck = inet_sk(sk_listener)->transparent; |
1208 | ireq->opt = tcp_v4_save_options(skb); | 1208 | ireq->opt = tcp_v4_save_options(skb); |
1209 | ireq->ireq_family = AF_INET; | ||
1210 | } | 1209 | } |
1211 | 1210 | ||
1212 | static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl, | 1211 | static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl, |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 2819137fc87d..21bc2eb53c57 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -197,7 +197,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
197 | ireq = inet_rsk(req); | 197 | ireq = inet_rsk(req); |
198 | treq = tcp_rsk(req); | 198 | treq = tcp_rsk(req); |
199 | treq->tfo_listener = false; | 199 | treq->tfo_listener = false; |
200 | ireq->ireq_family = AF_INET6; | ||
201 | 200 | ||
202 | if (security_inet_conn_request(sk, skb, req)) | 201 | if (security_inet_conn_request(sk, skb, req)) |
203 | goto out_free; | 202 | goto out_free; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a9568caf4675..cbdf6912d2c6 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -688,7 +688,6 @@ static void tcp_v6_init_req(struct request_sock *req, struct sock *sk, | |||
688 | atomic_inc(&skb->users); | 688 | atomic_inc(&skb->users); |
689 | ireq->pktopts = skb; | 689 | ireq->pktopts = skb; |
690 | } | 690 | } |
691 | ireq->ireq_family = AF_INET6; | ||
692 | } | 691 | } |
693 | 692 | ||
694 | static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl, | 693 | static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl, |