diff options
-rw-r--r-- | include/linux/udp.h | 2 | ||||
-rw-r--r-- | include/net/inet6_hashtables.h | 2 | ||||
-rw-r--r-- | include/net/inet_hashtables.h | 32 | ||||
-rw-r--r-- | include/net/netns/hash.h | 4 | ||||
-rw-r--r-- | include/net/request_sock.h | 5 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 13 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 27 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 4 | ||||
-rw-r--r-- | net/ipv4/inet_hashtables.c | 55 | ||||
-rw-r--r-- | net/ipv4/ping.c | 6 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 16 | ||||
-rw-r--r-- | net/ipv4/udp.c | 10 | ||||
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 58 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 28 | ||||
-rw-r--r-- | net/ipv6/udp.c | 16 |
17 files changed, 110 insertions, 174 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h index 247cfdcc4b08..87c094961bd5 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -34,7 +34,7 @@ static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb) | |||
34 | 34 | ||
35 | #define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) | 35 | #define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) |
36 | 36 | ||
37 | static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) | 37 | static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask) |
38 | { | 38 | { |
39 | return (num + net_hash_mix(net)) & mask; | 39 | return (num + net_hash_mix(net)) & mask; |
40 | } | 40 | } |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 9201afe083fa..7ff588ca6817 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -38,8 +38,6 @@ static inline unsigned int __inet6_ehashfn(const u32 lhash, | |||
38 | return jhash_3words(lhash, fhash, ports, initval); | 38 | return jhash_3words(lhash, fhash, ports, initval); |
39 | } | 39 | } |
40 | 40 | ||
41 | int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp); | ||
42 | |||
43 | /* | 41 | /* |
44 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so | 42 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so |
45 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM | 43 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index bcd64756e5fe..73fe0f9525d9 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -221,8 +221,8 @@ inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net, | |||
221 | void inet_bind_bucket_destroy(struct kmem_cache *cachep, | 221 | void inet_bind_bucket_destroy(struct kmem_cache *cachep, |
222 | struct inet_bind_bucket *tb); | 222 | struct inet_bind_bucket *tb); |
223 | 223 | ||
224 | static inline int inet_bhashfn(struct net *net, const __u16 lport, | 224 | static inline u32 inet_bhashfn(const struct net *net, const __u16 lport, |
225 | const int bhash_size) | 225 | const u32 bhash_size) |
226 | { | 226 | { |
227 | return (lport + net_hash_mix(net)) & (bhash_size - 1); | 227 | return (lport + net_hash_mix(net)) & (bhash_size - 1); |
228 | } | 228 | } |
@@ -231,7 +231,7 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, | |||
231 | const unsigned short snum); | 231 | const unsigned short snum); |
232 | 232 | ||
233 | /* These can have wildcards, don't try too hard. */ | 233 | /* These can have wildcards, don't try too hard. */ |
234 | static inline int inet_lhashfn(struct net *net, const unsigned short num) | 234 | static inline u32 inet_lhashfn(const struct net *net, const unsigned short num) |
235 | { | 235 | { |
236 | return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1); | 236 | return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1); |
237 | } | 237 | } |
@@ -249,6 +249,7 @@ void inet_put_port(struct sock *sk); | |||
249 | void inet_hashinfo_init(struct inet_hashinfo *h); | 249 | void inet_hashinfo_init(struct inet_hashinfo *h); |
250 | 250 | ||
251 | int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); | 251 | int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); |
252 | int __inet_hash(struct sock *sk, struct inet_timewait_sock *tw); | ||
252 | void inet_hash(struct sock *sk); | 253 | void inet_hash(struct sock *sk); |
253 | void inet_unhash(struct sock *sk); | 254 | void inet_unhash(struct sock *sk); |
254 | 255 | ||
@@ -383,13 +384,32 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, | |||
383 | iph->daddr, dport, inet_iif(skb)); | 384 | iph->daddr, dport, inet_iif(skb)); |
384 | } | 385 | } |
385 | 386 | ||
387 | u32 sk_ehashfn(const struct sock *sk); | ||
388 | u32 inet6_ehashfn(const struct net *net, | ||
389 | const struct in6_addr *laddr, const u16 lport, | ||
390 | const struct in6_addr *faddr, const __be16 fport); | ||
391 | |||
392 | static inline void sk_daddr_set(struct sock *sk, __be32 addr) | ||
393 | { | ||
394 | sk->sk_daddr = addr; /* alias of inet_daddr */ | ||
395 | #if IS_ENABLED(CONFIG_IPV6) | ||
396 | ipv6_addr_set_v4mapped(addr, &sk->sk_v6_daddr); | ||
397 | #endif | ||
398 | } | ||
399 | |||
400 | static inline void sk_rcv_saddr_set(struct sock *sk, __be32 addr) | ||
401 | { | ||
402 | sk->sk_rcv_saddr = addr; /* alias of inet_rcv_saddr */ | ||
403 | #if IS_ENABLED(CONFIG_IPV6) | ||
404 | ipv6_addr_set_v4mapped(addr, &sk->sk_v6_rcv_saddr); | ||
405 | #endif | ||
406 | } | ||
407 | |||
386 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, | 408 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, |
387 | struct sock *sk, u32 port_offset, | 409 | struct sock *sk, u32 port_offset, |
388 | int (*check_established)(struct inet_timewait_death_row *, | 410 | int (*check_established)(struct inet_timewait_death_row *, |
389 | struct sock *, __u16, | 411 | struct sock *, __u16, |
390 | struct inet_timewait_sock **), | 412 | struct inet_timewait_sock **)); |
391 | int (*hash)(struct sock *sk, | ||
392 | struct inet_timewait_sock *twp)); | ||
393 | 413 | ||
394 | int inet_hash_connect(struct inet_timewait_death_row *death_row, | 414 | int inet_hash_connect(struct inet_timewait_death_row *death_row, |
395 | struct sock *sk); | 415 | struct sock *sk); |
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h index c06ac58ca107..69a6715d9f3f 100644 --- a/include/net/netns/hash.h +++ b/include/net/netns/hash.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | struct net; | 6 | struct net; |
7 | 7 | ||
8 | static inline unsigned int net_hash_mix(struct net *net) | 8 | static inline u32 net_hash_mix(const struct net *net) |
9 | { | 9 | { |
10 | #ifdef CONFIG_NET_NS | 10 | #ifdef CONFIG_NET_NS |
11 | /* | 11 | /* |
@@ -13,7 +13,7 @@ static inline unsigned int net_hash_mix(struct net *net) | |||
13 | * always zeroed | 13 | * always zeroed |
14 | */ | 14 | */ |
15 | 15 | ||
16 | return (unsigned)(((unsigned long)net) >> L1_CACHE_SHIFT); | 16 | return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT); |
17 | #else | 17 | #else |
18 | return 0; | 18 | return 0; |
19 | #endif | 19 | #endif |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 3fa4f824900a..e7ef86340514 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -91,6 +91,11 @@ static inline struct request_sock *inet_reqsk(struct sock *sk) | |||
91 | return (struct request_sock *)sk; | 91 | return (struct request_sock *)sk; |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline struct sock *req_to_sk(struct request_sock *req) | ||
95 | { | ||
96 | return (struct sock *)req; | ||
97 | } | ||
98 | |||
94 | static inline void reqsk_free(struct request_sock *req) | 99 | static inline void reqsk_free(struct request_sock *req) |
95 | { | 100 | { |
96 | /* temporary debugging */ | 101 | /* temporary debugging */ |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index bf897829f4f0..e7ad291cd96b 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -89,10 +89,9 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
89 | 89 | ||
90 | if (inet->inet_saddr == 0) | 90 | if (inet->inet_saddr == 0) |
91 | inet->inet_saddr = fl4->saddr; | 91 | inet->inet_saddr = fl4->saddr; |
92 | inet->inet_rcv_saddr = inet->inet_saddr; | 92 | sk_rcv_saddr_set(sk, inet->inet_saddr); |
93 | |||
94 | inet->inet_dport = usin->sin_port; | 93 | inet->inet_dport = usin->sin_port; |
95 | inet->inet_daddr = daddr; | 94 | sk_daddr_set(sk, daddr); |
96 | 95 | ||
97 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 96 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
98 | if (inet_opt) | 97 | if (inet_opt) |
@@ -408,8 +407,8 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
408 | 407 | ||
409 | newinet = inet_sk(newsk); | 408 | newinet = inet_sk(newsk); |
410 | ireq = inet_rsk(req); | 409 | ireq = inet_rsk(req); |
411 | newinet->inet_daddr = ireq->ir_rmt_addr; | 410 | sk_daddr_set(newsk, ireq->ir_rmt_addr); |
412 | newinet->inet_rcv_saddr = ireq->ir_loc_addr; | 411 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); |
413 | newinet->inet_saddr = ireq->ir_loc_addr; | 412 | newinet->inet_saddr = ireq->ir_loc_addr; |
414 | newinet->inet_opt = ireq->opt; | 413 | newinet->inet_opt = ireq->opt; |
415 | ireq->opt = NULL; | 414 | ireq->opt = NULL; |
@@ -639,8 +638,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
639 | goto drop_and_free; | 638 | goto drop_and_free; |
640 | 639 | ||
641 | ireq = inet_rsk(req); | 640 | ireq = inet_rsk(req); |
642 | ireq->ir_loc_addr = ip_hdr(skb)->daddr; | 641 | sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); |
643 | ireq->ir_rmt_addr = ip_hdr(skb)->saddr; | 642 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); |
644 | ireq->ireq_family = AF_INET; | 643 | ireq->ireq_family = AF_INET; |
645 | ireq->ir_iif = sk->sk_bound_dev_if; | 644 | ireq->ir_iif = sk->sk_bound_dev_if; |
646 | 645 | ||
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d7e7c7b0a3f1..c655de5f67c9 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -40,19 +40,6 @@ | |||
40 | static const struct inet_connection_sock_af_ops dccp_ipv6_mapped; | 40 | static const struct inet_connection_sock_af_ops dccp_ipv6_mapped; |
41 | static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops; | 41 | static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops; |
42 | 42 | ||
43 | static void dccp_v6_hash(struct sock *sk) | ||
44 | { | ||
45 | if (sk->sk_state != DCCP_CLOSED) { | ||
46 | if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) { | ||
47 | inet_hash(sk); | ||
48 | return; | ||
49 | } | ||
50 | local_bh_disable(); | ||
51 | __inet6_hash(sk, NULL); | ||
52 | local_bh_enable(); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | /* add pseudo-header to DCCP checksum stored in skb->csum */ | 43 | /* add pseudo-header to DCCP checksum stored in skb->csum */ |
57 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, | 44 | static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, |
58 | const struct in6_addr *saddr, | 45 | const struct in6_addr *saddr, |
@@ -470,11 +457,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
470 | 457 | ||
471 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 458 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
472 | 459 | ||
473 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr); | 460 | newnp->saddr = newsk->sk_v6_rcv_saddr; |
474 | |||
475 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); | ||
476 | |||
477 | newsk->sk_v6_rcv_saddr = newnp->saddr; | ||
478 | 461 | ||
479 | inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; | 462 | inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; |
480 | newsk->sk_backlog_rcv = dccp_v4_do_rcv; | 463 | newsk->sk_backlog_rcv = dccp_v4_do_rcv; |
@@ -592,7 +575,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
592 | dccp_done(newsk); | 575 | dccp_done(newsk); |
593 | goto out; | 576 | goto out; |
594 | } | 577 | } |
595 | __inet6_hash(newsk, NULL); | 578 | __inet_hash(newsk, NULL); |
596 | 579 | ||
597 | return newsk; | 580 | return newsk; |
598 | 581 | ||
@@ -917,9 +900,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
917 | sk->sk_backlog_rcv = dccp_v6_do_rcv; | 900 | sk->sk_backlog_rcv = dccp_v6_do_rcv; |
918 | goto failure; | 901 | goto failure; |
919 | } | 902 | } |
920 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); | 903 | np->saddr = sk->sk_v6_rcv_saddr; |
921 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, &sk->sk_v6_rcv_saddr); | ||
922 | |||
923 | return err; | 904 | return err; |
924 | } | 905 | } |
925 | 906 | ||
@@ -1062,7 +1043,7 @@ static struct proto dccp_v6_prot = { | |||
1062 | .sendmsg = dccp_sendmsg, | 1043 | .sendmsg = dccp_sendmsg, |
1063 | .recvmsg = dccp_recvmsg, | 1044 | .recvmsg = dccp_recvmsg, |
1064 | .backlog_rcv = dccp_v6_do_rcv, | 1045 | .backlog_rcv = dccp_v6_do_rcv, |
1065 | .hash = dccp_v6_hash, | 1046 | .hash = inet_hash, |
1066 | .unhash = inet_unhash, | 1047 | .unhash = inet_unhash, |
1067 | .accept = inet_csk_accept, | 1048 | .accept = inet_csk_accept, |
1068 | .get_port = inet_csk_get_port, | 1049 | .get_port = inet_csk_get_port, |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 5105759e4e00..375dc71b9a64 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -107,7 +107,7 @@ static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { | |||
107 | 107 | ||
108 | static struct hlist_head inet_addr_lst[IN4_ADDR_HSIZE]; | 108 | static struct hlist_head inet_addr_lst[IN4_ADDR_HSIZE]; |
109 | 109 | ||
110 | static u32 inet_addr_hash(struct net *net, __be32 addr) | 110 | static u32 inet_addr_hash(const struct net *net, __be32 addr) |
111 | { | 111 | { |
112 | u32 val = (__force u32) addr ^ net_hash_mix(net); | 112 | u32 val = (__force u32) addr ^ net_hash_mix(net); |
113 | 113 | ||
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index e7ba59038c8d..74c39c9f3e11 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -742,14 +742,14 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
742 | 742 | ||
743 | if (bc) { | 743 | if (bc) { |
744 | /* Note: entry.sport and entry.userlocks are already set */ | 744 | /* Note: entry.sport and entry.userlocks are already set */ |
745 | entry_fill_addrs(&entry, (struct sock *)req); | 745 | entry_fill_addrs(&entry, req_to_sk(req)); |
746 | entry.dport = ntohs(ireq->ir_rmt_port); | 746 | entry.dport = ntohs(ireq->ir_rmt_port); |
747 | 747 | ||
748 | if (!inet_diag_bc_run(bc, &entry)) | 748 | if (!inet_diag_bc_run(bc, &entry)) |
749 | continue; | 749 | continue; |
750 | } | 750 | } |
751 | 751 | ||
752 | err = inet_req_diag_fill((struct sock *)req, skb, | 752 | err = inet_req_diag_fill(req_to_sk(req), skb, |
753 | NETLINK_CB(cb->skb).portid, | 753 | NETLINK_CB(cb->skb).portid, |
754 | cb->nlh->nlmsg_seq, | 754 | cb->nlh->nlmsg_seq, |
755 | NLM_F_MULTI, cb->nlh); | 755 | NLM_F_MULTI, cb->nlh); |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index c28bca4cc15b..0fb841b9d834 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -24,9 +24,9 @@ | |||
24 | #include <net/secure_seq.h> | 24 | #include <net/secure_seq.h> |
25 | #include <net/ip.h> | 25 | #include <net/ip.h> |
26 | 26 | ||
27 | static unsigned int inet_ehashfn(struct net *net, const __be32 laddr, | 27 | static u32 inet_ehashfn(const struct net *net, const __be32 laddr, |
28 | const __u16 lport, const __be32 faddr, | 28 | const __u16 lport, const __be32 faddr, |
29 | const __be16 fport) | 29 | const __be16 fport) |
30 | { | 30 | { |
31 | static u32 inet_ehash_secret __read_mostly; | 31 | static u32 inet_ehash_secret __read_mostly; |
32 | 32 | ||
@@ -36,17 +36,21 @@ static unsigned int inet_ehashfn(struct net *net, const __be32 laddr, | |||
36 | inet_ehash_secret + net_hash_mix(net)); | 36 | inet_ehash_secret + net_hash_mix(net)); |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | /* This function handles inet_sock, but also timewait and request sockets | |
40 | static unsigned int inet_sk_ehashfn(const struct sock *sk) | 40 | * for IPv4/IPv6. |
41 | */ | ||
42 | u32 sk_ehashfn(const struct sock *sk) | ||
41 | { | 43 | { |
42 | const struct inet_sock *inet = inet_sk(sk); | 44 | #if IS_ENABLED(CONFIG_IPV6) |
43 | const __be32 laddr = inet->inet_rcv_saddr; | 45 | if (sk->sk_family == AF_INET6 && |
44 | const __u16 lport = inet->inet_num; | 46 | !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) |
45 | const __be32 faddr = inet->inet_daddr; | 47 | return inet6_ehashfn(sock_net(sk), |
46 | const __be16 fport = inet->inet_dport; | 48 | &sk->sk_v6_rcv_saddr, sk->sk_num, |
47 | struct net *net = sock_net(sk); | 49 | &sk->sk_v6_daddr, sk->sk_dport); |
48 | 50 | #endif | |
49 | return inet_ehashfn(net, laddr, lport, faddr, fport); | 51 | return inet_ehashfn(sock_net(sk), |
52 | sk->sk_rcv_saddr, sk->sk_num, | ||
53 | sk->sk_daddr, sk->sk_dport); | ||
50 | } | 54 | } |
51 | 55 | ||
52 | /* | 56 | /* |
@@ -407,13 +411,13 @@ int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw) | |||
407 | { | 411 | { |
408 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; | 412 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; |
409 | struct hlist_nulls_head *list; | 413 | struct hlist_nulls_head *list; |
410 | spinlock_t *lock; | ||
411 | struct inet_ehash_bucket *head; | 414 | struct inet_ehash_bucket *head; |
415 | spinlock_t *lock; | ||
412 | int twrefcnt = 0; | 416 | int twrefcnt = 0; |
413 | 417 | ||
414 | WARN_ON(!sk_unhashed(sk)); | 418 | WARN_ON(!sk_unhashed(sk)); |
415 | 419 | ||
416 | sk->sk_hash = inet_sk_ehashfn(sk); | 420 | sk->sk_hash = sk_ehashfn(sk); |
417 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); | 421 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); |
418 | list = &head->chain; | 422 | list = &head->chain; |
419 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); | 423 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); |
@@ -430,15 +434,13 @@ int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw) | |||
430 | } | 434 | } |
431 | EXPORT_SYMBOL_GPL(__inet_hash_nolisten); | 435 | EXPORT_SYMBOL_GPL(__inet_hash_nolisten); |
432 | 436 | ||
433 | static void __inet_hash(struct sock *sk) | 437 | int __inet_hash(struct sock *sk, struct inet_timewait_sock *tw) |
434 | { | 438 | { |
435 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; | 439 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; |
436 | struct inet_listen_hashbucket *ilb; | 440 | struct inet_listen_hashbucket *ilb; |
437 | 441 | ||
438 | if (sk->sk_state != TCP_LISTEN) { | 442 | if (sk->sk_state != TCP_LISTEN) |
439 | __inet_hash_nolisten(sk, NULL); | 443 | return __inet_hash_nolisten(sk, tw); |
440 | return; | ||
441 | } | ||
442 | 444 | ||
443 | WARN_ON(!sk_unhashed(sk)); | 445 | WARN_ON(!sk_unhashed(sk)); |
444 | ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | 446 | ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; |
@@ -447,13 +449,15 @@ static void __inet_hash(struct sock *sk) | |||
447 | __sk_nulls_add_node_rcu(sk, &ilb->head); | 449 | __sk_nulls_add_node_rcu(sk, &ilb->head); |
448 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 450 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
449 | spin_unlock(&ilb->lock); | 451 | spin_unlock(&ilb->lock); |
452 | return 0; | ||
450 | } | 453 | } |
454 | EXPORT_SYMBOL(__inet_hash); | ||
451 | 455 | ||
452 | void inet_hash(struct sock *sk) | 456 | void inet_hash(struct sock *sk) |
453 | { | 457 | { |
454 | if (sk->sk_state != TCP_CLOSE) { | 458 | if (sk->sk_state != TCP_CLOSE) { |
455 | local_bh_disable(); | 459 | local_bh_disable(); |
456 | __inet_hash(sk); | 460 | __inet_hash(sk, NULL); |
457 | local_bh_enable(); | 461 | local_bh_enable(); |
458 | } | 462 | } |
459 | } | 463 | } |
@@ -484,8 +488,7 @@ EXPORT_SYMBOL_GPL(inet_unhash); | |||
484 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, | 488 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, |
485 | struct sock *sk, u32 port_offset, | 489 | struct sock *sk, u32 port_offset, |
486 | int (*check_established)(struct inet_timewait_death_row *, | 490 | int (*check_established)(struct inet_timewait_death_row *, |
487 | struct sock *, __u16, struct inet_timewait_sock **), | 491 | struct sock *, __u16, struct inet_timewait_sock **)) |
488 | int (*hash)(struct sock *sk, struct inet_timewait_sock *twp)) | ||
489 | { | 492 | { |
490 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 493 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
491 | const unsigned short snum = inet_sk(sk)->inet_num; | 494 | const unsigned short snum = inet_sk(sk)->inet_num; |
@@ -555,7 +558,7 @@ ok: | |||
555 | inet_bind_hash(sk, tb, port); | 558 | inet_bind_hash(sk, tb, port); |
556 | if (sk_unhashed(sk)) { | 559 | if (sk_unhashed(sk)) { |
557 | inet_sk(sk)->inet_sport = htons(port); | 560 | inet_sk(sk)->inet_sport = htons(port); |
558 | twrefcnt += hash(sk, tw); | 561 | twrefcnt += __inet_hash_nolisten(sk, tw); |
559 | } | 562 | } |
560 | if (tw) | 563 | if (tw) |
561 | twrefcnt += inet_twsk_bind_unhash(tw, hinfo); | 564 | twrefcnt += inet_twsk_bind_unhash(tw, hinfo); |
@@ -577,7 +580,7 @@ ok: | |||
577 | tb = inet_csk(sk)->icsk_bind_hash; | 580 | tb = inet_csk(sk)->icsk_bind_hash; |
578 | spin_lock_bh(&head->lock); | 581 | spin_lock_bh(&head->lock); |
579 | if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { | 582 | if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { |
580 | hash(sk, NULL); | 583 | __inet_hash_nolisten(sk, NULL); |
581 | spin_unlock_bh(&head->lock); | 584 | spin_unlock_bh(&head->lock); |
582 | return 0; | 585 | return 0; |
583 | } else { | 586 | } else { |
@@ -597,7 +600,7 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
597 | struct sock *sk) | 600 | struct sock *sk) |
598 | { | 601 | { |
599 | return __inet_hash_connect(death_row, sk, inet_sk_port_offset(sk), | 602 | return __inet_hash_connect(death_row, sk, inet_sk_port_offset(sk), |
600 | __inet_check_established, __inet_hash_nolisten); | 603 | __inet_check_established); |
601 | } | 604 | } |
602 | EXPORT_SYMBOL_GPL(inet_hash_connect); | 605 | EXPORT_SYMBOL_GPL(inet_hash_connect); |
603 | 606 | ||
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index fd88f868776f..344e7cdfb8d4 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -64,11 +64,11 @@ EXPORT_SYMBOL_GPL(pingv6_ops); | |||
64 | 64 | ||
65 | static u16 ping_port_rover; | 65 | static u16 ping_port_rover; |
66 | 66 | ||
67 | static inline int ping_hashfn(struct net *net, unsigned int num, unsigned int mask) | 67 | static inline u32 ping_hashfn(const struct net *net, u32 num, u32 mask) |
68 | { | 68 | { |
69 | int res = (num + net_hash_mix(net)) & mask; | 69 | u32 res = (num + net_hash_mix(net)) & mask; |
70 | 70 | ||
71 | pr_debug("hash(%d) = %d\n", num, res); | 71 | pr_debug("hash(%u) = %u\n", num, res); |
72 | return res; | 72 | return res; |
73 | } | 73 | } |
74 | EXPORT_SYMBOL_GPL(ping_hash); | 74 | EXPORT_SYMBOL_GPL(ping_hash); |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 34e755403715..ef01d8570358 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -337,8 +337,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) | |||
337 | req->mss = mss; | 337 | req->mss = mss; |
338 | ireq->ir_num = ntohs(th->dest); | 338 | ireq->ir_num = ntohs(th->dest); |
339 | ireq->ir_rmt_port = th->source; | 339 | ireq->ir_rmt_port = th->source; |
340 | ireq->ir_loc_addr = ip_hdr(skb)->daddr; | 340 | sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); |
341 | ireq->ir_rmt_addr = ip_hdr(skb)->saddr; | 341 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); |
342 | ireq->ir_mark = inet_request_mark(sk, skb); | 342 | ireq->ir_mark = inet_request_mark(sk, skb); |
343 | ireq->snd_wscale = tcp_opt.snd_wscale; | 343 | ireq->snd_wscale = tcp_opt.snd_wscale; |
344 | ireq->sack_ok = tcp_opt.sack_ok; | 344 | ireq->sack_ok = tcp_opt.sack_ok; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 80067d5858b4..ddd0b1f25b96 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -189,7 +189,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
189 | 189 | ||
190 | if (!inet->inet_saddr) | 190 | if (!inet->inet_saddr) |
191 | inet->inet_saddr = fl4->saddr; | 191 | inet->inet_saddr = fl4->saddr; |
192 | inet->inet_rcv_saddr = inet->inet_saddr; | 192 | sk_rcv_saddr_set(sk, inet->inet_saddr); |
193 | 193 | ||
194 | if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) { | 194 | if (tp->rx_opt.ts_recent_stamp && inet->inet_daddr != daddr) { |
195 | /* Reset inherited state */ | 195 | /* Reset inherited state */ |
@@ -204,7 +204,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
204 | tcp_fetch_timewait_stamp(sk, &rt->dst); | 204 | tcp_fetch_timewait_stamp(sk, &rt->dst); |
205 | 205 | ||
206 | inet->inet_dport = usin->sin_port; | 206 | inet->inet_dport = usin->sin_port; |
207 | inet->inet_daddr = daddr; | 207 | sk_daddr_set(sk, daddr); |
208 | 208 | ||
209 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 209 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
210 | if (inet_opt) | 210 | if (inet_opt) |
@@ -1219,14 +1219,14 @@ static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) | |||
1219 | 1219 | ||
1220 | #endif | 1220 | #endif |
1221 | 1221 | ||
1222 | static void tcp_v4_init_req(struct request_sock *req, struct sock *sk, | 1222 | static void tcp_v4_init_req(struct request_sock *req, struct sock *sk_listener, |
1223 | struct sk_buff *skb) | 1223 | struct sk_buff *skb) |
1224 | { | 1224 | { |
1225 | struct inet_request_sock *ireq = inet_rsk(req); | 1225 | struct inet_request_sock *ireq = inet_rsk(req); |
1226 | 1226 | ||
1227 | ireq->ir_loc_addr = ip_hdr(skb)->daddr; | 1227 | sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); |
1228 | ireq->ir_rmt_addr = ip_hdr(skb)->saddr; | 1228 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); |
1229 | ireq->no_srccheck = inet_sk(sk)->transparent; | 1229 | ireq->no_srccheck = inet_sk(sk_listener)->transparent; |
1230 | ireq->opt = tcp_v4_save_options(skb); | 1230 | ireq->opt = tcp_v4_save_options(skb); |
1231 | ireq->ireq_family = AF_INET; | 1231 | ireq->ireq_family = AF_INET; |
1232 | } | 1232 | } |
@@ -1319,8 +1319,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1319 | newtp = tcp_sk(newsk); | 1319 | newtp = tcp_sk(newsk); |
1320 | newinet = inet_sk(newsk); | 1320 | newinet = inet_sk(newsk); |
1321 | ireq = inet_rsk(req); | 1321 | ireq = inet_rsk(req); |
1322 | newinet->inet_daddr = ireq->ir_rmt_addr; | 1322 | sk_daddr_set(newsk, ireq->ir_rmt_addr); |
1323 | newinet->inet_rcv_saddr = ireq->ir_loc_addr; | 1323 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); |
1324 | newinet->inet_saddr = ireq->ir_loc_addr; | 1324 | newinet->inet_saddr = ireq->ir_loc_addr; |
1325 | inet_opt = ireq->opt; | 1325 | inet_opt = ireq->opt; |
1326 | rcu_assign_pointer(newinet->inet_opt, inet_opt); | 1326 | rcu_assign_pointer(newinet->inet_opt, inet_opt); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index f27556e2158b..294af16633af 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -318,8 +318,8 @@ static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) | |||
318 | inet1->inet_rcv_saddr == inet2->inet_rcv_saddr)); | 318 | inet1->inet_rcv_saddr == inet2->inet_rcv_saddr)); |
319 | } | 319 | } |
320 | 320 | ||
321 | static unsigned int udp4_portaddr_hash(struct net *net, __be32 saddr, | 321 | static u32 udp4_portaddr_hash(const struct net *net, __be32 saddr, |
322 | unsigned int port) | 322 | unsigned int port) |
323 | { | 323 | { |
324 | return jhash_1word((__force u32)saddr, net_hash_mix(net)) ^ port; | 324 | return jhash_1word((__force u32)saddr, net_hash_mix(net)) ^ port; |
325 | } | 325 | } |
@@ -421,9 +421,9 @@ static inline int compute_score2(struct sock *sk, struct net *net, | |||
421 | return score; | 421 | return score; |
422 | } | 422 | } |
423 | 423 | ||
424 | static unsigned int udp_ehashfn(struct net *net, const __be32 laddr, | 424 | static u32 udp_ehashfn(const struct net *net, const __be32 laddr, |
425 | const __u16 lport, const __be32 faddr, | 425 | const __u16 lport, const __be32 faddr, |
426 | const __be16 fport) | 426 | const __be16 fport) |
427 | { | 427 | { |
428 | static u32 udp_ehash_secret __read_mostly; | 428 | static u32 udp_ehash_secret __read_mostly; |
429 | 429 | ||
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 051dffb49c90..033f17816ef4 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -23,11 +23,9 @@ | |||
23 | #include <net/secure_seq.h> | 23 | #include <net/secure_seq.h> |
24 | #include <net/ip.h> | 24 | #include <net/ip.h> |
25 | 25 | ||
26 | static unsigned int inet6_ehashfn(struct net *net, | 26 | u32 inet6_ehashfn(const struct net *net, |
27 | const struct in6_addr *laddr, | 27 | const struct in6_addr *laddr, const u16 lport, |
28 | const u16 lport, | 28 | const struct in6_addr *faddr, const __be16 fport) |
29 | const struct in6_addr *faddr, | ||
30 | const __be16 fport) | ||
31 | { | 29 | { |
32 | static u32 inet6_ehash_secret __read_mostly; | 30 | static u32 inet6_ehash_secret __read_mostly; |
33 | static u32 ipv6_hash_secret __read_mostly; | 31 | static u32 ipv6_hash_secret __read_mostly; |
@@ -44,54 +42,6 @@ static unsigned int inet6_ehashfn(struct net *net, | |||
44 | inet6_ehash_secret + net_hash_mix(net)); | 42 | inet6_ehash_secret + net_hash_mix(net)); |
45 | } | 43 | } |
46 | 44 | ||
47 | static int inet6_sk_ehashfn(const struct sock *sk) | ||
48 | { | ||
49 | const struct inet_sock *inet = inet_sk(sk); | ||
50 | const struct in6_addr *laddr = &sk->sk_v6_rcv_saddr; | ||
51 | const struct in6_addr *faddr = &sk->sk_v6_daddr; | ||
52 | const __u16 lport = inet->inet_num; | ||
53 | const __be16 fport = inet->inet_dport; | ||
54 | struct net *net = sock_net(sk); | ||
55 | |||
56 | return inet6_ehashfn(net, laddr, lport, faddr, fport); | ||
57 | } | ||
58 | |||
59 | int __inet6_hash(struct sock *sk, struct inet_timewait_sock *tw) | ||
60 | { | ||
61 | struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; | ||
62 | int twrefcnt = 0; | ||
63 | |||
64 | WARN_ON(!sk_unhashed(sk)); | ||
65 | |||
66 | if (sk->sk_state == TCP_LISTEN) { | ||
67 | struct inet_listen_hashbucket *ilb; | ||
68 | |||
69 | ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | ||
70 | spin_lock(&ilb->lock); | ||
71 | __sk_nulls_add_node_rcu(sk, &ilb->head); | ||
72 | spin_unlock(&ilb->lock); | ||
73 | } else { | ||
74 | unsigned int hash; | ||
75 | struct hlist_nulls_head *list; | ||
76 | spinlock_t *lock; | ||
77 | |||
78 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); | ||
79 | list = &inet_ehash_bucket(hashinfo, hash)->chain; | ||
80 | lock = inet_ehash_lockp(hashinfo, hash); | ||
81 | spin_lock(lock); | ||
82 | __sk_nulls_add_node_rcu(sk, list); | ||
83 | if (tw) { | ||
84 | WARN_ON(sk->sk_hash != tw->tw_hash); | ||
85 | twrefcnt = inet_twsk_unhash(tw); | ||
86 | } | ||
87 | spin_unlock(lock); | ||
88 | } | ||
89 | |||
90 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | ||
91 | return twrefcnt; | ||
92 | } | ||
93 | EXPORT_SYMBOL(__inet6_hash); | ||
94 | |||
95 | /* | 45 | /* |
96 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so | 46 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so |
97 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM | 47 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM |
@@ -320,6 +270,6 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row, | |||
320 | struct sock *sk) | 270 | struct sock *sk) |
321 | { | 271 | { |
322 | return __inet_hash_connect(death_row, sk, inet6_sk_port_offset(sk), | 272 | return __inet_hash_connect(death_row, sk, inet6_sk_port_offset(sk), |
323 | __inet6_check_established, __inet6_hash); | 273 | __inet6_check_established); |
324 | } | 274 | } |
325 | EXPORT_SYMBOL_GPL(inet6_hash_connect); | 275 | EXPORT_SYMBOL_GPL(inet6_hash_connect); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index e4761b22307b..720676d073d9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -104,19 +104,6 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | static void tcp_v6_hash(struct sock *sk) | ||
108 | { | ||
109 | if (sk->sk_state != TCP_CLOSE) { | ||
110 | if (inet_csk(sk)->icsk_af_ops == &ipv6_mapped) { | ||
111 | tcp_prot.hash(sk); | ||
112 | return; | ||
113 | } | ||
114 | local_bh_disable(); | ||
115 | __inet6_hash(sk, NULL); | ||
116 | local_bh_enable(); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | static __u32 tcp_v6_init_sequence(const struct sk_buff *skb) | 107 | static __u32 tcp_v6_init_sequence(const struct sk_buff *skb) |
121 | { | 108 | { |
122 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, | 109 | return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32, |
@@ -233,11 +220,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
233 | tp->af_specific = &tcp_sock_ipv6_specific; | 220 | tp->af_specific = &tcp_sock_ipv6_specific; |
234 | #endif | 221 | #endif |
235 | goto failure; | 222 | goto failure; |
236 | } else { | ||
237 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); | ||
238 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, | ||
239 | &sk->sk_v6_rcv_saddr); | ||
240 | } | 223 | } |
224 | np->saddr = sk->sk_v6_rcv_saddr; | ||
241 | 225 | ||
242 | return err; | 226 | return err; |
243 | } | 227 | } |
@@ -1078,11 +1062,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1078 | 1062 | ||
1079 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 1063 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
1080 | 1064 | ||
1081 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr); | 1065 | newnp->saddr = newsk->sk_v6_rcv_saddr; |
1082 | |||
1083 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); | ||
1084 | |||
1085 | newsk->sk_v6_rcv_saddr = newnp->saddr; | ||
1086 | 1066 | ||
1087 | inet_csk(newsk)->icsk_af_ops = &ipv6_mapped; | 1067 | inet_csk(newsk)->icsk_af_ops = &ipv6_mapped; |
1088 | newsk->sk_backlog_rcv = tcp_v4_do_rcv; | 1068 | newsk->sk_backlog_rcv = tcp_v4_do_rcv; |
@@ -1231,7 +1211,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1231 | tcp_done(newsk); | 1211 | tcp_done(newsk); |
1232 | goto out; | 1212 | goto out; |
1233 | } | 1213 | } |
1234 | __inet6_hash(newsk, NULL); | 1214 | __inet_hash(newsk, NULL); |
1235 | 1215 | ||
1236 | return newsk; | 1216 | return newsk; |
1237 | 1217 | ||
@@ -1890,7 +1870,7 @@ struct proto tcpv6_prot = { | |||
1890 | .sendpage = tcp_sendpage, | 1870 | .sendpage = tcp_sendpage, |
1891 | .backlog_rcv = tcp_v6_do_rcv, | 1871 | .backlog_rcv = tcp_v6_do_rcv, |
1892 | .release_cb = tcp_release_cb, | 1872 | .release_cb = tcp_release_cb, |
1893 | .hash = tcp_v6_hash, | 1873 | .hash = inet_hash, |
1894 | .unhash = inet_unhash, | 1874 | .unhash = inet_unhash, |
1895 | .get_port = inet_csk_get_port, | 1875 | .get_port = inet_csk_get_port, |
1896 | .enter_memory_pressure = tcp_enter_memory_pressure, | 1876 | .enter_memory_pressure = tcp_enter_memory_pressure, |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 70568a4548e4..7fe0329c0d37 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -53,11 +53,11 @@ | |||
53 | #include <trace/events/skb.h> | 53 | #include <trace/events/skb.h> |
54 | #include "udp_impl.h" | 54 | #include "udp_impl.h" |
55 | 55 | ||
56 | static unsigned int udp6_ehashfn(struct net *net, | 56 | static u32 udp6_ehashfn(const struct net *net, |
57 | const struct in6_addr *laddr, | 57 | const struct in6_addr *laddr, |
58 | const u16 lport, | 58 | const u16 lport, |
59 | const struct in6_addr *faddr, | 59 | const struct in6_addr *faddr, |
60 | const __be16 fport) | 60 | const __be16 fport) |
61 | { | 61 | { |
62 | static u32 udp6_ehash_secret __read_mostly; | 62 | static u32 udp6_ehash_secret __read_mostly; |
63 | static u32 udp_ipv6_hash_secret __read_mostly; | 63 | static u32 udp_ipv6_hash_secret __read_mostly; |
@@ -104,9 +104,9 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) | |||
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | static unsigned int udp6_portaddr_hash(struct net *net, | 107 | static u32 udp6_portaddr_hash(const struct net *net, |
108 | const struct in6_addr *addr6, | 108 | const struct in6_addr *addr6, |
109 | unsigned int port) | 109 | unsigned int port) |
110 | { | 110 | { |
111 | unsigned int hash, mix = net_hash_mix(net); | 111 | unsigned int hash, mix = net_hash_mix(net); |
112 | 112 | ||