inet_hashtables.c (2dbb9b9e6df67d444fbe425c7f6014858d337adf) | inet_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 INET transport hashtables 7 * 8 * Authors: Lotsa people, from code originally in tcp --- 314 unchanged lines hidden (view full) --- 323 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 324 if (ilb2->count > ilb->count) 325 goto port_lookup; 326 327 result = inet_lhash2_lookup(net, ilb2, skb, doff, 328 saddr, sport, daddr, hnum, 329 dif, sdif); 330 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 INET transport hashtables 7 * 8 * Authors: Lotsa people, from code originally in tcp --- 314 unchanged lines hidden (view full) --- 323 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 324 if (ilb2->count > ilb->count) 325 goto port_lookup; 326 327 result = inet_lhash2_lookup(net, ilb2, skb, doff, 328 saddr, sport, daddr, hnum, 329 dif, sdif); 330 if (result) |
331 return result; | 331 goto done; |
332 333 /* Lookup lhash2 with INADDR_ANY */ 334 335 hash2 = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum); 336 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 337 if (ilb2->count > ilb->count) 338 goto port_lookup; 339 | 332 333 /* Lookup lhash2 with INADDR_ANY */ 334 335 hash2 = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum); 336 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 337 if (ilb2->count > ilb->count) 338 goto port_lookup; 339 |
340 return inet_lhash2_lookup(net, ilb2, skb, doff, 341 saddr, sport, daddr, hnum, 342 dif, sdif); | 340 result = inet_lhash2_lookup(net, ilb2, skb, doff, 341 saddr, sport, daddr, hnum, 342 dif, sdif); 343 goto done; |
343 344port_lookup: 345 sk_for_each_rcu(sk, &ilb->head) { 346 score = compute_score(sk, net, hnum, daddr, 347 dif, sdif, exact_dif); 348 if (score > hiscore) { 349 if (sk->sk_reuseport) { 350 phash = inet_ehashfn(net, daddr, hnum, 351 saddr, sport); 352 result = reuseport_select_sock(sk, phash, 353 skb, doff); 354 if (result) | 344 345port_lookup: 346 sk_for_each_rcu(sk, &ilb->head) { 347 score = compute_score(sk, net, hnum, daddr, 348 dif, sdif, exact_dif); 349 if (score > hiscore) { 350 if (sk->sk_reuseport) { 351 phash = inet_ehashfn(net, daddr, hnum, 352 saddr, sport); 353 result = reuseport_select_sock(sk, phash, 354 skb, doff); 355 if (result) |
355 return result; | 356 goto done; |
356 } 357 result = sk; 358 hiscore = score; 359 } 360 } | 357 } 358 result = sk; 359 hiscore = score; 360 } 361 } |
362done: 363 if (unlikely(IS_ERR(result))) 364 return NULL; |
|
361 return result; 362} 363EXPORT_SYMBOL_GPL(__inet_lookup_listener); 364 365/* All sockets share common refcount, but have different destructors */ 366void sock_gen_put(struct sock *sk) 367{ 368 if (!refcount_dec_and_test(&sk->sk_refcnt)) --- 476 unchanged lines hidden --- | 365 return result; 366} 367EXPORT_SYMBOL_GPL(__inet_lookup_listener); 368 369/* All sockets share common refcount, but have different destructors */ 370void sock_gen_put(struct sock *sk) 371{ 372 if (!refcount_dec_and_test(&sk->sk_refcnt)) --- 476 unchanged lines hidden --- |