route.c (e905a9edab7f4f14f9213b52234e4a346c690911) | route.c (093c2ca4167cf66f69020329d14138da0da8599b) |
---|---|
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 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 275 unchanged lines hidden (view full) --- 284 } 285 return r; 286} 287 288static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 289{ 290 struct rt_cache_iter_state *st = rcu_dereference(seq->private); 291 | 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 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 275 unchanged lines hidden (view full) --- 284 } 285 return r; 286} 287 288static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 289{ 290 struct rt_cache_iter_state *st = rcu_dereference(seq->private); 291 |
292 r = r->u.rt_next; | 292 r = r->u.dst.rt_next; |
293 while (!r) { 294 rcu_read_unlock_bh(); 295 if (--st->bucket < 0) 296 break; 297 rcu_read_lock_bh(); 298 r = rt_hash_table[st->bucket].chain; 299 } 300 return r; --- 206 unchanged lines hidden (view full) --- 507 call_rcu_bh(&rt->u.dst.rcu_head, dst_rcu_free); 508} 509 510static __inline__ int rt_fast_clean(struct rtable *rth) 511{ 512 /* Kill broadcast/multicast entries very aggresively, if they 513 collide in hash table with more useful entries */ 514 return (rth->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) && | 293 while (!r) { 294 rcu_read_unlock_bh(); 295 if (--st->bucket < 0) 296 break; 297 rcu_read_lock_bh(); 298 r = rt_hash_table[st->bucket].chain; 299 } 300 return r; --- 206 unchanged lines hidden (view full) --- 507 call_rcu_bh(&rt->u.dst.rcu_head, dst_rcu_free); 508} 509 510static __inline__ int rt_fast_clean(struct rtable *rth) 511{ 512 /* Kill broadcast/multicast entries very aggresively, if they 513 collide in hash table with more useful entries */ 514 return (rth->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) && |
515 rth->fl.iif && rth->u.rt_next; | 515 rth->fl.iif && rth->u.dst.rt_next; |
516} 517 518static __inline__ int rt_valuable(struct rtable *rth) 519{ 520 return (rth->rt_flags & (RTCF_REDIRECTED | RTCF_NOTIFY)) || 521 rth->u.dst.expires; 522} 523 --- 66 unchanged lines hidden (view full) --- 590 591 while ((rth = *rthp) != NULL) { 592 if (rth == expentry) 593 passedexpired = 1; 594 595 if (((*rthp)->u.dst.flags & DST_BALANCED) != 0 && 596 compare_keys(&(*rthp)->fl, &expentry->fl)) { 597 if (*rthp == expentry) { | 516} 517 518static __inline__ int rt_valuable(struct rtable *rth) 519{ 520 return (rth->rt_flags & (RTCF_REDIRECTED | RTCF_NOTIFY)) || 521 rth->u.dst.expires; 522} 523 --- 66 unchanged lines hidden (view full) --- 590 591 while ((rth = *rthp) != NULL) { 592 if (rth == expentry) 593 passedexpired = 1; 594 595 if (((*rthp)->u.dst.flags & DST_BALANCED) != 0 && 596 compare_keys(&(*rthp)->fl, &expentry->fl)) { 597 if (*rthp == expentry) { |
598 *rthp = rth->u.rt_next; | 598 *rthp = rth->u.dst.rt_next; |
599 continue; 600 } else { | 599 continue; 600 } else { |
601 *rthp = rth->u.rt_next; | 601 *rthp = rth->u.dst.rt_next; |
602 rt_free(rth); 603 if (removed_count) 604 ++(*removed_count); 605 } 606 } else { 607 if (!((*rthp)->u.dst.flags & DST_BALANCED) && 608 passedexpired && !nextstep) | 602 rt_free(rth); 603 if (removed_count) 604 ++(*removed_count); 605 } 606 } else { 607 if (!((*rthp)->u.dst.flags & DST_BALANCED) && 608 passedexpired && !nextstep) |
609 nextstep = &rth->u.rt_next; | 609 nextstep = &rth->u.dst.rt_next; |
610 | 610 |
611 rthp = &rth->u.rt_next; | 611 rthp = &rth->u.dst.rt_next; |
612 } 613 } 614 615 rt_free(expentry); 616 if (removed_count) 617 ++(*removed_count); 618 619 return nextstep; --- 24 unchanged lines hidden (view full) --- 644 if (*rthp == 0) 645 continue; 646 spin_lock(rt_hash_lock_addr(i)); 647 while ((rth = *rthp) != NULL) { 648 if (rth->u.dst.expires) { 649 /* Entry is expired even if it is in use */ 650 if (time_before_eq(now, rth->u.dst.expires)) { 651 tmo >>= 1; | 612 } 613 } 614 615 rt_free(expentry); 616 if (removed_count) 617 ++(*removed_count); 618 619 return nextstep; --- 24 unchanged lines hidden (view full) --- 644 if (*rthp == 0) 645 continue; 646 spin_lock(rt_hash_lock_addr(i)); 647 while ((rth = *rthp) != NULL) { 648 if (rth->u.dst.expires) { 649 /* Entry is expired even if it is in use */ 650 if (time_before_eq(now, rth->u.dst.expires)) { 651 tmo >>= 1; |
652 rthp = &rth->u.rt_next; | 652 rthp = &rth->u.dst.rt_next; |
653 continue; 654 } 655 } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) { 656 tmo >>= 1; | 653 continue; 654 } 655 } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) { 656 tmo >>= 1; |
657 rthp = &rth->u.rt_next; | 657 rthp = &rth->u.dst.rt_next; |
658 continue; 659 } 660 661 /* Cleanup aged off entries. */ 662#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 663 /* remove all related balanced entries if necessary */ 664 if (rth->u.dst.flags & DST_BALANCED) { 665 rthp = rt_remove_balanced_route( 666 &rt_hash_table[i].chain, 667 rth, NULL); 668 if (!rthp) 669 break; 670 } else { | 658 continue; 659 } 660 661 /* Cleanup aged off entries. */ 662#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 663 /* remove all related balanced entries if necessary */ 664 if (rth->u.dst.flags & DST_BALANCED) { 665 rthp = rt_remove_balanced_route( 666 &rt_hash_table[i].chain, 667 rth, NULL); 668 if (!rthp) 669 break; 670 } else { |
671 *rthp = rth->u.rt_next; | 671 *rthp = rth->u.dst.rt_next; |
672 rt_free(rth); 673 } 674#else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ | 672 rt_free(rth); 673 } 674#else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ |
675 *rthp = rth->u.rt_next; | 675 *rthp = rth->u.dst.rt_next; |
676 rt_free(rth); 677#endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ 678 } 679 spin_unlock(rt_hash_lock_addr(i)); 680 681 /* Fallback loop breaker. */ 682 if (time_after(jiffies, now)) 683 break; --- 17 unchanged lines hidden (view full) --- 701 for (i = rt_hash_mask; i >= 0; i--) { 702 spin_lock_bh(rt_hash_lock_addr(i)); 703 rth = rt_hash_table[i].chain; 704 if (rth) 705 rt_hash_table[i].chain = NULL; 706 spin_unlock_bh(rt_hash_lock_addr(i)); 707 708 for (; rth; rth = next) { | 676 rt_free(rth); 677#endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ 678 } 679 spin_unlock(rt_hash_lock_addr(i)); 680 681 /* Fallback loop breaker. */ 682 if (time_after(jiffies, now)) 683 break; --- 17 unchanged lines hidden (view full) --- 701 for (i = rt_hash_mask; i >= 0; i--) { 702 spin_lock_bh(rt_hash_lock_addr(i)); 703 rth = rt_hash_table[i].chain; 704 if (rth) 705 rt_hash_table[i].chain = NULL; 706 spin_unlock_bh(rt_hash_lock_addr(i)); 707 708 for (; rth; rth = next) { |
709 next = rth->u.rt_next; | 709 next = rth->u.dst.rt_next; |
710 rt_free(rth); 711 } 712 } 713} 714 715static DEFINE_SPINLOCK(rt_flush_lock); 716 717void rt_cache_flush(int delay) --- 117 unchanged lines hidden (view full) --- 835 unsigned long tmo = expire; 836 837 k = (k + 1) & rt_hash_mask; 838 rthp = &rt_hash_table[k].chain; 839 spin_lock_bh(rt_hash_lock_addr(k)); 840 while ((rth = *rthp) != NULL) { 841 if (!rt_may_expire(rth, tmo, expire)) { 842 tmo >>= 1; | 710 rt_free(rth); 711 } 712 } 713} 714 715static DEFINE_SPINLOCK(rt_flush_lock); 716 717void rt_cache_flush(int delay) --- 117 unchanged lines hidden (view full) --- 835 unsigned long tmo = expire; 836 837 k = (k + 1) & rt_hash_mask; 838 rthp = &rt_hash_table[k].chain; 839 spin_lock_bh(rt_hash_lock_addr(k)); 840 while ((rth = *rthp) != NULL) { 841 if (!rt_may_expire(rth, tmo, expire)) { 842 tmo >>= 1; |
843 rthp = &rth->u.rt_next; | 843 rthp = &rth->u.dst.rt_next; |
844 continue; 845 } 846#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 847 /* remove all related balanced entries 848 * if necessary 849 */ 850 if (rth->u.dst.flags & DST_BALANCED) { 851 int r; 852 853 rthp = rt_remove_balanced_route( 854 &rt_hash_table[k].chain, 855 rth, 856 &r); 857 goal -= r; 858 if (!rthp) 859 break; 860 } else { | 844 continue; 845 } 846#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 847 /* remove all related balanced entries 848 * if necessary 849 */ 850 if (rth->u.dst.flags & DST_BALANCED) { 851 int r; 852 853 rthp = rt_remove_balanced_route( 854 &rt_hash_table[k].chain, 855 rth, 856 &r); 857 goal -= r; 858 if (!rthp) 859 break; 860 } else { |
861 *rthp = rth->u.rt_next; | 861 *rthp = rth->u.dst.rt_next; |
862 rt_free(rth); 863 goal--; 864 } 865#else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ | 862 rt_free(rth); 863 goal--; 864 } 865#else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ |
866 *rthp = rth->u.rt_next; | 866 *rthp = rth->u.dst.rt_next; |
867 rt_free(rth); 868 goal--; 869#endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ 870 } 871 spin_unlock_bh(rt_hash_lock_addr(k)); 872 if (goal <= 0) 873 break; 874 } --- 67 unchanged lines hidden (view full) --- 942 while ((rth = *rthp) != NULL) { 943#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 944 if (!(rth->u.dst.flags & DST_BALANCED) && 945 compare_keys(&rth->fl, &rt->fl)) { 946#else 947 if (compare_keys(&rth->fl, &rt->fl)) { 948#endif 949 /* Put it first */ | 867 rt_free(rth); 868 goal--; 869#endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ 870 } 871 spin_unlock_bh(rt_hash_lock_addr(k)); 872 if (goal <= 0) 873 break; 874 } --- 67 unchanged lines hidden (view full) --- 942 while ((rth = *rthp) != NULL) { 943#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED 944 if (!(rth->u.dst.flags & DST_BALANCED) && 945 compare_keys(&rth->fl, &rt->fl)) { 946#else 947 if (compare_keys(&rth->fl, &rt->fl)) { 948#endif 949 /* Put it first */ |
950 *rthp = rth->u.rt_next; | 950 *rthp = rth->u.dst.rt_next; |
951 /* 952 * Since lookup is lockfree, the deletion 953 * must be visible to another weakly ordered CPU before 954 * the insertion at the start of the hash chain. 955 */ | 951 /* 952 * Since lookup is lockfree, the deletion 953 * must be visible to another weakly ordered CPU before 954 * the insertion at the start of the hash chain. 955 */ |
956 rcu_assign_pointer(rth->u.rt_next, | 956 rcu_assign_pointer(rth->u.dst.rt_next, |
957 rt_hash_table[hash].chain); 958 /* 959 * Since lookup is lockfree, the update writes 960 * must be ordered for consistency on SMP. 961 */ 962 rcu_assign_pointer(rt_hash_table[hash].chain, rth); 963 964 rth->u.dst.__use++; --- 13 unchanged lines hidden (view full) --- 978 cand = rth; 979 candp = rthp; 980 min_score = score; 981 } 982 } 983 984 chain_length++; 985 | 957 rt_hash_table[hash].chain); 958 /* 959 * Since lookup is lockfree, the update writes 960 * must be ordered for consistency on SMP. 961 */ 962 rcu_assign_pointer(rt_hash_table[hash].chain, rth); 963 964 rth->u.dst.__use++; --- 13 unchanged lines hidden (view full) --- 978 cand = rth; 979 candp = rthp; 980 min_score = score; 981 } 982 } 983 984 chain_length++; 985 |
986 rthp = &rth->u.rt_next; | 986 rthp = &rth->u.dst.rt_next; |
987 } 988 989 if (cand) { 990 /* ip_rt_gc_elasticity used to be average length of chain 991 * length, when exceeded gc becomes really aggressive. 992 * 993 * The second limit is less certain. At the moment it allows 994 * only 2 entries per bucket. We will see. 995 */ 996 if (chain_length > ip_rt_gc_elasticity) { | 987 } 988 989 if (cand) { 990 /* ip_rt_gc_elasticity used to be average length of chain 991 * length, when exceeded gc becomes really aggressive. 992 * 993 * The second limit is less certain. At the moment it allows 994 * only 2 entries per bucket. We will see. 995 */ 996 if (chain_length > ip_rt_gc_elasticity) { |
997 *candp = cand->u.rt_next; | 997 *candp = cand->u.dst.rt_next; |
998 rt_free(cand); 999 } 1000 } 1001 1002 /* Try to bind route to arp only if it is output 1003 route or unicast forwarding path. 1004 */ 1005 if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) { --- 23 unchanged lines hidden (view full) --- 1029 1030 if (net_ratelimit()) 1031 printk(KERN_WARNING "Neighbour table overflow.\n"); 1032 rt_drop(rt); 1033 return -ENOBUFS; 1034 } 1035 } 1036 | 998 rt_free(cand); 999 } 1000 } 1001 1002 /* Try to bind route to arp only if it is output 1003 route or unicast forwarding path. 1004 */ 1005 if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) { --- 23 unchanged lines hidden (view full) --- 1029 1030 if (net_ratelimit()) 1031 printk(KERN_WARNING "Neighbour table overflow.\n"); 1032 rt_drop(rt); 1033 return -ENOBUFS; 1034 } 1035 } 1036 |
1037 rt->u.rt_next = rt_hash_table[hash].chain; | 1037 rt->u.dst.rt_next = rt_hash_table[hash].chain; |
1038#if RT_CACHE_DEBUG >= 2 | 1038#if RT_CACHE_DEBUG >= 2 |
1039 if (rt->u.rt_next) { | 1039 if (rt->u.dst.rt_next) { |
1040 struct rtable *trt; 1041 printk(KERN_DEBUG "rt_cache @%02x: %u.%u.%u.%u", hash, 1042 NIPQUAD(rt->rt_dst)); | 1040 struct rtable *trt; 1041 printk(KERN_DEBUG "rt_cache @%02x: %u.%u.%u.%u", hash, 1042 NIPQUAD(rt->rt_dst)); |
1043 for (trt = rt->u.rt_next; trt; trt = trt->u.rt_next) | 1043 for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next) |
1044 printk(" . %u.%u.%u.%u", NIPQUAD(trt->rt_dst)); 1045 printk("\n"); 1046 } 1047#endif 1048 rt_hash_table[hash].chain = rt; 1049 spin_unlock_bh(rt_hash_lock_addr(hash)); 1050 *rp = rt; 1051 return 0; --- 60 unchanged lines hidden (view full) --- 1112 1113static void rt_del(unsigned hash, struct rtable *rt) 1114{ 1115 struct rtable **rthp; 1116 1117 spin_lock_bh(rt_hash_lock_addr(hash)); 1118 ip_rt_put(rt); 1119 for (rthp = &rt_hash_table[hash].chain; *rthp; | 1044 printk(" . %u.%u.%u.%u", NIPQUAD(trt->rt_dst)); 1045 printk("\n"); 1046 } 1047#endif 1048 rt_hash_table[hash].chain = rt; 1049 spin_unlock_bh(rt_hash_lock_addr(hash)); 1050 *rp = rt; 1051 return 0; --- 60 unchanged lines hidden (view full) --- 1112 1113static void rt_del(unsigned hash, struct rtable *rt) 1114{ 1115 struct rtable **rthp; 1116 1117 spin_lock_bh(rt_hash_lock_addr(hash)); 1118 ip_rt_put(rt); 1119 for (rthp = &rt_hash_table[hash].chain; *rthp; |
1120 rthp = &(*rthp)->u.rt_next) | 1120 rthp = &(*rthp)->u.dst.rt_next) |
1121 if (*rthp == rt) { | 1121 if (*rthp == rt) { |
1122 *rthp = rt->u.rt_next; | 1122 *rthp = rt->u.dst.rt_next; |
1123 rt_free(rt); 1124 break; 1125 } 1126 spin_unlock_bh(rt_hash_lock_addr(hash)); 1127} 1128 1129void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, 1130 __be32 saddr, struct net_device *dev) --- 31 unchanged lines hidden (view full) --- 1162 rcu_read_lock(); 1163 while ((rth = rcu_dereference(*rthp)) != NULL) { 1164 struct rtable *rt; 1165 1166 if (rth->fl.fl4_dst != daddr || 1167 rth->fl.fl4_src != skeys[i] || 1168 rth->fl.oif != ikeys[k] || 1169 rth->fl.iif != 0) { | 1123 rt_free(rt); 1124 break; 1125 } 1126 spin_unlock_bh(rt_hash_lock_addr(hash)); 1127} 1128 1129void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, 1130 __be32 saddr, struct net_device *dev) --- 31 unchanged lines hidden (view full) --- 1162 rcu_read_lock(); 1163 while ((rth = rcu_dereference(*rthp)) != NULL) { 1164 struct rtable *rt; 1165 1166 if (rth->fl.fl4_dst != daddr || 1167 rth->fl.fl4_src != skeys[i] || 1168 rth->fl.oif != ikeys[k] || 1169 rth->fl.iif != 0) { |
1170 rthp = &rth->u.rt_next; | 1170 rthp = &rth->u.dst.rt_next; |
1171 continue; 1172 } 1173 1174 if (rth->rt_dst != daddr || 1175 rth->rt_src != saddr || 1176 rth->u.dst.error || 1177 rth->rt_gateway != old_gw || 1178 rth->u.dst.dev != dev) --- 232 unchanged lines hidden (view full) --- 1411 if (ipv4_config.no_pmtu_disc) 1412 return 0; 1413 1414 for (i = 0; i < 2; i++) { 1415 unsigned hash = rt_hash(daddr, skeys[i], 0); 1416 1417 rcu_read_lock(); 1418 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 1171 continue; 1172 } 1173 1174 if (rth->rt_dst != daddr || 1175 rth->rt_src != saddr || 1176 rth->u.dst.error || 1177 rth->rt_gateway != old_gw || 1178 rth->u.dst.dev != dev) --- 232 unchanged lines hidden (view full) --- 1411 if (ipv4_config.no_pmtu_disc) 1412 return 0; 1413 1414 for (i = 0; i < 2; i++) { 1415 unsigned hash = rt_hash(daddr, skeys[i], 0); 1416 1417 rcu_read_lock(); 1418 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
1419 rth = rcu_dereference(rth->u.rt_next)) { | 1419 rth = rcu_dereference(rth->u.dst.rt_next)) { |
1420 if (rth->fl.fl4_dst == daddr && 1421 rth->fl.fl4_src == skeys[i] && 1422 rth->rt_dst == daddr && 1423 rth->rt_src == iph->saddr && 1424 rth->fl.iif == 0 && 1425 !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { 1426 unsigned short mtu = new_mtu; 1427 --- 666 unchanged lines hidden (view full) --- 2094 unsigned hash; 2095 int iif = dev->ifindex; 2096 2097 tos &= IPTOS_RT_MASK; 2098 hash = rt_hash(daddr, saddr, iif); 2099 2100 rcu_read_lock(); 2101 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 1420 if (rth->fl.fl4_dst == daddr && 1421 rth->fl.fl4_src == skeys[i] && 1422 rth->rt_dst == daddr && 1423 rth->rt_src == iph->saddr && 1424 rth->fl.iif == 0 && 1425 !(dst_metric_locked(&rth->u.dst, RTAX_MTU))) { 1426 unsigned short mtu = new_mtu; 1427 --- 666 unchanged lines hidden (view full) --- 2094 unsigned hash; 2095 int iif = dev->ifindex; 2096 2097 tos &= IPTOS_RT_MASK; 2098 hash = rt_hash(daddr, saddr, iif); 2099 2100 rcu_read_lock(); 2101 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
2102 rth = rcu_dereference(rth->u.rt_next)) { | 2102 rth = rcu_dereference(rth->u.dst.rt_next)) { |
2103 if (rth->fl.fl4_dst == daddr && 2104 rth->fl.fl4_src == saddr && 2105 rth->fl.iif == iif && 2106 rth->fl.oif == 0 && 2107 rth->fl.mark == skb->mark && 2108 rth->fl.fl4_tos == tos) { 2109 rth->u.dst.lastuse = jiffies; 2110 dst_hold(&rth->u.dst); --- 447 unchanged lines hidden (view full) --- 2558{ 2559 unsigned hash; 2560 struct rtable *rth; 2561 2562 hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif); 2563 2564 rcu_read_lock_bh(); 2565 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2103 if (rth->fl.fl4_dst == daddr && 2104 rth->fl.fl4_src == saddr && 2105 rth->fl.iif == iif && 2106 rth->fl.oif == 0 && 2107 rth->fl.mark == skb->mark && 2108 rth->fl.fl4_tos == tos) { 2109 rth->u.dst.lastuse = jiffies; 2110 dst_hold(&rth->u.dst); --- 447 unchanged lines hidden (view full) --- 2558{ 2559 unsigned hash; 2560 struct rtable *rth; 2561 2562 hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif); 2563 2564 rcu_read_lock_bh(); 2565 for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
2566 rth = rcu_dereference(rth->u.rt_next)) { | 2566 rth = rcu_dereference(rth->u.dst.rt_next)) { |
2567 if (rth->fl.fl4_dst == flp->fl4_dst && 2568 rth->fl.fl4_src == flp->fl4_src && 2569 rth->fl.iif == 0 && 2570 rth->fl.oif == flp->oif && 2571 rth->fl.mark == flp->mark && 2572 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2573 (IPTOS_RT_MASK | RTO_ONLINK))) { 2574 --- 245 unchanged lines hidden (view full) --- 2820 s_h = cb->args[0]; 2821 s_idx = idx = cb->args[1]; 2822 for (h = 0; h <= rt_hash_mask; h++) { 2823 if (h < s_h) continue; 2824 if (h > s_h) 2825 s_idx = 0; 2826 rcu_read_lock_bh(); 2827 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; | 2567 if (rth->fl.fl4_dst == flp->fl4_dst && 2568 rth->fl.fl4_src == flp->fl4_src && 2569 rth->fl.iif == 0 && 2570 rth->fl.oif == flp->oif && 2571 rth->fl.mark == flp->mark && 2572 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2573 (IPTOS_RT_MASK | RTO_ONLINK))) { 2574 --- 245 unchanged lines hidden (view full) --- 2820 s_h = cb->args[0]; 2821 s_idx = idx = cb->args[1]; 2822 for (h = 0; h <= rt_hash_mask; h++) { 2823 if (h < s_h) continue; 2824 if (h > s_h) 2825 s_idx = 0; 2826 rcu_read_lock_bh(); 2827 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; |
2828 rt = rcu_dereference(rt->u.rt_next), idx++) { | 2828 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { |
2829 if (idx < s_idx) 2830 continue; 2831 skb->dst = dst_clone(&rt->u.dst); 2832 if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid, 2833 cb->nlh->nlmsg_seq, RTM_NEWROUTE, 2834 1, NLM_F_MULTI) <= 0) { 2835 dst_release(xchg(&skb->dst, NULL)); 2836 rcu_read_unlock_bh(); --- 366 unchanged lines hidden --- | 2829 if (idx < s_idx) 2830 continue; 2831 skb->dst = dst_clone(&rt->u.dst); 2832 if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid, 2833 cb->nlh->nlmsg_seq, RTM_NEWROUTE, 2834 1, NLM_F_MULTI) <= 0) { 2835 dst_release(xchg(&skb->dst, NULL)); 2836 rcu_read_unlock_bh(); --- 366 unchanged lines hidden --- |