[TCP]: Fix zero port problem in IPv6
When we link a socket into the hash table, we need to make sure that we set the num/port fields so that it shows us with a non-zero port value in proc/netlink and on the wire. This code and comment is copied over from the IPv4 stack as is. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
c33d4568ac
commit
3759fa9c55
|
@ -87,7 +87,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
|
||||||
struct inet_timewait_sock **twp)
|
struct inet_timewait_sock **twp)
|
||||||
{
|
{
|
||||||
struct inet_hashinfo *hinfo = death_row->hashinfo;
|
struct inet_hashinfo *hinfo = death_row->hashinfo;
|
||||||
const struct inet_sock *inet = inet_sk(sk);
|
struct inet_sock *inet = inet_sk(sk);
|
||||||
const struct ipv6_pinfo *np = inet6_sk(sk);
|
const struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
const struct in6_addr *daddr = &np->rcv_saddr;
|
const struct in6_addr *daddr = &np->rcv_saddr;
|
||||||
const struct in6_addr *saddr = &np->daddr;
|
const struct in6_addr *saddr = &np->daddr;
|
||||||
|
@ -129,6 +129,10 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
|
||||||
}
|
}
|
||||||
|
|
||||||
unique:
|
unique:
|
||||||
|
/* Must record num and sport now. Otherwise we will see
|
||||||
|
* in hash table socket with a funny identity. */
|
||||||
|
inet->num = lport;
|
||||||
|
inet->sport = htons(lport);
|
||||||
BUG_TRAP(sk_unhashed(sk));
|
BUG_TRAP(sk_unhashed(sk));
|
||||||
__sk_add_node(sk, &head->chain);
|
__sk_add_node(sk, &head->chain);
|
||||||
sk->sk_hash = hash;
|
sk->sk_hash = hash;
|
||||||
|
|
Loading…
Reference in New Issue