route.c (f3efbe582b5396d134024c03a5fa253f2a85d9a6) | route.c (c6153b5b77650879d78dec76414213c76dd8d574) |
---|---|
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 * Authors: Ross Biro --- 2900 unchanged lines hidden (view full) --- 2909 return -EINVAL; 2910 if (get_user(delay, (int __user *)newval)) 2911 return -EFAULT; 2912 net = (struct net *)table->extra1; 2913 rt_cache_flush(net, delay); 2914 return 0; 2915} 2916 | 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 * Authors: Ross Biro --- 2900 unchanged lines hidden (view full) --- 2909 return -EINVAL; 2910 if (get_user(delay, (int __user *)newval)) 2911 return -EFAULT; 2912 net = (struct net *)table->extra1; 2913 rt_cache_flush(net, delay); 2914 return 0; 2915} 2916 |
2917static void rt_secret_reschedule(int old) 2918{ 2919 struct net *net; 2920 int new = ip_rt_secret_interval; 2921 int diff = new - old; 2922 2923 if (!diff) 2924 return; 2925 2926 rtnl_lock(); 2927 for_each_net(net) { 2928 int deleted = del_timer_sync(&net->ipv4.rt_secret_timer); 2929 2930 if (!new) 2931 continue; 2932 2933 if (deleted) { 2934 long time = net->ipv4.rt_secret_timer.expires - jiffies; 2935 2936 if (time <= 0 || (time += diff) <= 0) 2937 time = 0; 2938 2939 net->ipv4.rt_secret_timer.expires = time; 2940 } else 2941 net->ipv4.rt_secret_timer.expires = new; 2942 2943 net->ipv4.rt_secret_timer.expires += jiffies; 2944 add_timer(&net->ipv4.rt_secret_timer); 2945 } 2946 rtnl_unlock(); 2947} 2948 2949static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, 2950 struct file *filp, 2951 void __user *buffer, size_t *lenp, 2952 loff_t *ppos) 2953{ 2954 int old = ip_rt_secret_interval; 2955 int ret = proc_dointvec_jiffies(ctl, write, filp, buffer, lenp, ppos); 2956 2957 rt_secret_reschedule(old); 2958 2959 return ret; 2960} 2961 2962static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table, 2963 int __user *name, 2964 int nlen, 2965 void __user *oldval, 2966 size_t __user *oldlenp, 2967 void __user *newval, 2968 size_t newlen) 2969{ 2970 int old = ip_rt_secret_interval; 2971 int ret = sysctl_jiffies(table, name, nlen, oldval, oldlenp, newval, 2972 newlen); 2973 2974 rt_secret_reschedule(old); 2975 2976 return ret; 2977} 2978 |
|
2917static ctl_table ipv4_route_table[] = { 2918 { 2919 .ctl_name = NET_IPV4_ROUTE_GC_THRESH, 2920 .procname = "gc_thresh", 2921 .data = &ipv4_dst_ops.gc_thresh, 2922 .maxlen = sizeof(int), 2923 .mode = 0644, 2924 .proc_handler = &proc_dointvec, --- 118 unchanged lines hidden (view full) --- 3043 .proc_handler = &proc_dointvec, 3044 }, 3045 { 3046 .ctl_name = NET_IPV4_ROUTE_SECRET_INTERVAL, 3047 .procname = "secret_interval", 3048 .data = &ip_rt_secret_interval, 3049 .maxlen = sizeof(int), 3050 .mode = 0644, | 2979static ctl_table ipv4_route_table[] = { 2980 { 2981 .ctl_name = NET_IPV4_ROUTE_GC_THRESH, 2982 .procname = "gc_thresh", 2983 .data = &ipv4_dst_ops.gc_thresh, 2984 .maxlen = sizeof(int), 2985 .mode = 0644, 2986 .proc_handler = &proc_dointvec, --- 118 unchanged lines hidden (view full) --- 3105 .proc_handler = &proc_dointvec, 3106 }, 3107 { 3108 .ctl_name = NET_IPV4_ROUTE_SECRET_INTERVAL, 3109 .procname = "secret_interval", 3110 .data = &ip_rt_secret_interval, 3111 .maxlen = sizeof(int), 3112 .mode = 0644, |
3051 .proc_handler = &proc_dointvec_jiffies, 3052 .strategy = &sysctl_jiffies, | 3113 .proc_handler = &ipv4_sysctl_rt_secret_interval, 3114 .strategy = &ipv4_sysctl_rt_secret_interval_strategy, |
3053 }, 3054 { .ctl_name = 0 } 3055}; 3056 3057static __net_initdata struct ctl_path ipv4_route_path[] = { 3058 { .procname = "net", .ctl_name = CTL_NET, }, 3059 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 3060 { .procname = "route", .ctl_name = NET_IPV4_ROUTE, }, --- 60 unchanged lines hidden (view full) --- 3121 atomic_set(&net->ipv4.rt_genid, 3122 (int) ((num_physpages ^ (num_physpages>>8)) ^ 3123 (jiffies ^ (jiffies >> 7)))); 3124 3125 net->ipv4.rt_secret_timer.function = rt_secret_rebuild; 3126 net->ipv4.rt_secret_timer.data = (unsigned long)net; 3127 init_timer_deferrable(&net->ipv4.rt_secret_timer); 3128 | 3115 }, 3116 { .ctl_name = 0 } 3117}; 3118 3119static __net_initdata struct ctl_path ipv4_route_path[] = { 3120 { .procname = "net", .ctl_name = CTL_NET, }, 3121 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 3122 { .procname = "route", .ctl_name = NET_IPV4_ROUTE, }, --- 60 unchanged lines hidden (view full) --- 3183 atomic_set(&net->ipv4.rt_genid, 3184 (int) ((num_physpages ^ (num_physpages>>8)) ^ 3185 (jiffies ^ (jiffies >> 7)))); 3186 3187 net->ipv4.rt_secret_timer.function = rt_secret_rebuild; 3188 net->ipv4.rt_secret_timer.data = (unsigned long)net; 3189 init_timer_deferrable(&net->ipv4.rt_secret_timer); 3190 |
3129 net->ipv4.rt_secret_timer.expires = 3130 jiffies + net_random() % ip_rt_secret_interval + 3131 ip_rt_secret_interval; 3132 add_timer(&net->ipv4.rt_secret_timer); | 3191 if (ip_rt_secret_interval) { 3192 net->ipv4.rt_secret_timer.expires = 3193 jiffies + net_random() % ip_rt_secret_interval + 3194 ip_rt_secret_interval; 3195 add_timer(&net->ipv4.rt_secret_timer); 3196 } |
3133 return 0; 3134} 3135 3136static __net_exit void rt_secret_timer_exit(struct net *net) 3137{ 3138 del_timer_sync(&net->ipv4.rt_secret_timer); 3139} 3140 --- 92 unchanged lines hidden --- | 3197 return 0; 3198} 3199 3200static __net_exit void rt_secret_timer_exit(struct net *net) 3201{ 3202 del_timer_sync(&net->ipv4.rt_secret_timer); 3203} 3204 --- 92 unchanged lines hidden --- |