You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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
@@ -23,11 +23,9 @@
|
||||
#include <net/secure_seq.h>
|
||||
#include <net/ip.h>
|
||||
|
||||
static u32 inet6_ehashfn(const struct net *net,
|
||||
const struct in6_addr *laddr,
|
||||
const u16 lport,
|
||||
const struct in6_addr *faddr,
|
||||
const __be16 fport)
|
||||
u32 inet6_ehashfn(const struct net *net,
|
||||
const struct in6_addr *laddr, const u16 lport,
|
||||
const struct in6_addr *faddr, const __be16 fport)
|
||||
{
|
||||
static u32 inet6_ehash_secret __read_mostly;
|
||||
static u32 ipv6_hash_secret __read_mostly;
|
||||
@@ -44,18 +42,6 @@ static u32 inet6_ehashfn(const struct net *net,
|
||||
inet6_ehash_secret + net_hash_mix(net));
|
||||
}
|
||||
|
||||
static int inet6_sk_ehashfn(const struct sock *sk)
|
||||
{
|
||||
const struct inet_sock *inet = inet_sk(sk);
|
||||
const struct in6_addr *laddr = &sk->sk_v6_rcv_saddr;
|
||||
const struct in6_addr *faddr = &sk->sk_v6_daddr;
|
||||
const __u16 lport = inet->inet_num;
|
||||
const __be16 fport = inet->inet_dport;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
return inet6_ehashfn(net, laddr, lport, faddr, fport);
|
||||
}
|
||||
|
||||
int __inet6_hash(struct sock *sk, struct inet_timewait_sock *tw)
|
||||
{
|
||||
struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
|
||||
@@ -75,7 +61,7 @@ int __inet6_hash(struct sock *sk, struct inet_timewait_sock *tw)
|
||||
struct hlist_nulls_head *list;
|
||||
spinlock_t *lock;
|
||||
|
||||
sk->sk_hash = hash = inet6_sk_ehashfn(sk);
|
||||
sk->sk_hash = hash = sk_ehashfn(sk);
|
||||
list = &inet_ehash_bucket(hashinfo, hash)->chain;
|
||||
lock = inet_ehash_lockp(hashinfo, hash);
|
||||
spin_lock(lock);
|
||||
|
||||
Reference in New Issue
Block a user