inet: add IPv6 support to sk_ehashfn()
Intent is to converge IPv4 & IPv6 inet_hash functions to factorize code. IPv4 sockets initialize sk_rcv_saddr and sk_v6_daddr in this patch, thanks to new sk_daddr_set() and sk_rcv_saddr_set() helpers. __inet6_hash can now use sk_ehashfn() instead of a private inet6_sk_ehashfn() and will simply use __inet_hash() in a following patch. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
5b441f76f1
commit
d1e559d0b1
@@ -233,11 +233,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
tp->af_specific = &tcp_sock_ipv6_specific;
|
||||
#endif
|
||||
goto failure;
|
||||
} else {
|
||||
ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr);
|
||||
ipv6_addr_set_v4mapped(inet->inet_rcv_saddr,
|
||||
&sk->sk_v6_rcv_saddr);
|
||||
}
|
||||
np->saddr = sk->sk_v6_rcv_saddr;
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -1078,11 +1075,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
||||
|
||||
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
|
||||
|
||||
ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr);
|
||||
|
||||
ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr);
|
||||
|
||||
newsk->sk_v6_rcv_saddr = newnp->saddr;
|
||||
newnp->saddr = newsk->sk_v6_rcv_saddr;
|
||||
|
||||
inet_csk(newsk)->icsk_af_ops = &ipv6_mapped;
|
||||
newsk->sk_backlog_rcv = tcp_v4_do_rcv;
|
||||
|
||||
Reference in New Issue
Block a user