]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ipv4/inet_hashtables.c
ipv4: split inet_ehashfn to hash functions per compilation unit
[karo-tx-linux.git] / net / ipv4 / inet_hashtables.c
index a4b66bbe4f218160b893a6e719ff60acf3e05ae7..18aa668d0cc96bb33911d3014727690377a8bc6d 100644 (file)
 #include <net/secure_seq.h>
 #include <net/ip.h>
 
+static unsigned int inet_ehashfn(struct net *net, const __be32 laddr,
+                                const __u16 lport, const __be32 faddr,
+                                const __be16 fport)
+{
+       return __inet_ehashfn(laddr, lport, faddr, fport,
+                             inet_ehash_secret + net_hash_mix(net));
+}
+
+
+static unsigned int inet_sk_ehashfn(const struct sock *sk)
+{
+       const struct inet_sock *inet = inet_sk(sk);
+       const __be32 laddr = inet->inet_rcv_saddr;
+       const __u16 lport = inet->inet_num;
+       const __be32 faddr = inet->inet_daddr;
+       const __be16 fport = inet->inet_dport;
+       struct net *net = sock_net(sk);
+
+       return inet_ehashfn(net, laddr, lport, faddr, fport);
+}
+
 /*
  * Allocate and initialize a new local port bind bucket.
  * The bindhash mutex for snum's hash chain must be held here.