inet6_hashtables.c (9e90c7985229430428dc9ba0ec7fe422901b456d) inet6_hashtables.c (8217ca653ec601246832d562207bc24bdf652d2f)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic INET6 transport hashtables
7 *
8 * Authors: Lotsa people, from code originally in tcp, generalised here

--- 177 unchanged lines hidden (view full) ---

186 ilb2 = inet_lhash2_bucket(hashinfo, hash2);
187 if (ilb2->count > ilb->count)
188 goto port_lookup;
189
190 result = inet6_lhash2_lookup(net, ilb2, skb, doff,
191 saddr, sport, daddr, hnum,
192 dif, sdif);
193 if (result)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Generic INET6 transport hashtables
7 *
8 * Authors: Lotsa people, from code originally in tcp, generalised here

--- 177 unchanged lines hidden (view full) ---

186 ilb2 = inet_lhash2_bucket(hashinfo, hash2);
187 if (ilb2->count > ilb->count)
188 goto port_lookup;
189
190 result = inet6_lhash2_lookup(net, ilb2, skb, doff,
191 saddr, sport, daddr, hnum,
192 dif, sdif);
193 if (result)
194 return result;
194 goto done;
195
196 /* Lookup lhash2 with in6addr_any */
197
198 hash2 = ipv6_portaddr_hash(net, &in6addr_any, hnum);
199 ilb2 = inet_lhash2_bucket(hashinfo, hash2);
200 if (ilb2->count > ilb->count)
201 goto port_lookup;
202
195
196 /* Lookup lhash2 with in6addr_any */
197
198 hash2 = ipv6_portaddr_hash(net, &in6addr_any, hnum);
199 ilb2 = inet_lhash2_bucket(hashinfo, hash2);
200 if (ilb2->count > ilb->count)
201 goto port_lookup;
202
203 return inet6_lhash2_lookup(net, ilb2, skb, doff,
204 saddr, sport, daddr, hnum,
205 dif, sdif);
203 result = inet6_lhash2_lookup(net, ilb2, skb, doff,
204 saddr, sport, daddr, hnum,
205 dif, sdif);
206 goto done;
206
207port_lookup:
208 sk_for_each(sk, &ilb->head) {
209 score = compute_score(sk, net, hnum, daddr, dif, sdif, exact_dif);
210 if (score > hiscore) {
211 if (sk->sk_reuseport) {
212 phash = inet6_ehashfn(net, daddr, hnum,
213 saddr, sport);
214 result = reuseport_select_sock(sk, phash,
215 skb, doff);
216 if (result)
207
208port_lookup:
209 sk_for_each(sk, &ilb->head) {
210 score = compute_score(sk, net, hnum, daddr, dif, sdif, exact_dif);
211 if (score > hiscore) {
212 if (sk->sk_reuseport) {
213 phash = inet6_ehashfn(net, daddr, hnum,
214 saddr, sport);
215 result = reuseport_select_sock(sk, phash,
216 skb, doff);
217 if (result)
217 return result;
218 goto done;
218 }
219 result = sk;
220 hiscore = score;
221 }
222 }
219 }
220 result = sk;
221 hiscore = score;
222 }
223 }
224done:
225 if (unlikely(IS_ERR(result)))
226 return NULL;
223 return result;
224}
225EXPORT_SYMBOL_GPL(inet6_lookup_listener);
226
227struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
228 struct sk_buff *skb, int doff,
229 const struct in6_addr *saddr, const __be16 sport,
230 const struct in6_addr *daddr, const __be16 dport,

--- 112 unchanged lines hidden ---
227 return result;
228}
229EXPORT_SYMBOL_GPL(inet6_lookup_listener);
230
231struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
232 struct sk_buff *skb, int doff,
233 const struct in6_addr *saddr, const __be16 sport,
234 const struct in6_addr *daddr, const __be16 dport,

--- 112 unchanged lines hidden ---