diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 73 |
1 files changed, 9 insertions, 64 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 5b1050a5d874..0d9f584a3811 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3056,23 +3056,6 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, | |||
3056 | return -EINVAL; | 3056 | return -EINVAL; |
3057 | } | 3057 | } |
3058 | 3058 | ||
3059 | static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, | ||
3060 | void __user *oldval, | ||
3061 | size_t __user *oldlenp, | ||
3062 | void __user *newval, | ||
3063 | size_t newlen) | ||
3064 | { | ||
3065 | int delay; | ||
3066 | struct net *net; | ||
3067 | if (newlen != sizeof(int)) | ||
3068 | return -EINVAL; | ||
3069 | if (get_user(delay, (int __user *)newval)) | ||
3070 | return -EFAULT; | ||
3071 | net = (struct net *)table->extra1; | ||
3072 | rt_cache_flush(net, delay); | ||
3073 | return 0; | ||
3074 | } | ||
3075 | |||
3076 | static void rt_secret_reschedule(int old) | 3059 | static void rt_secret_reschedule(int old) |
3077 | { | 3060 | { |
3078 | struct net *net; | 3061 | struct net *net; |
@@ -3117,23 +3100,8 @@ static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, | |||
3117 | return ret; | 3100 | return ret; |
3118 | } | 3101 | } |
3119 | 3102 | ||
3120 | static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table, | ||
3121 | void __user *oldval, | ||
3122 | size_t __user *oldlenp, | ||
3123 | void __user *newval, | ||
3124 | size_t newlen) | ||
3125 | { | ||
3126 | int old = ip_rt_secret_interval; | ||
3127 | int ret = sysctl_jiffies(table, oldval, oldlenp, newval, newlen); | ||
3128 | |||
3129 | rt_secret_reschedule(old); | ||
3130 | |||
3131 | return ret; | ||
3132 | } | ||
3133 | |||
3134 | static ctl_table ipv4_route_table[] = { | 3103 | static ctl_table ipv4_route_table[] = { |
3135 | { | 3104 | { |
3136 | .ctl_name = NET_IPV4_ROUTE_GC_THRESH, | ||
3137 | .procname = "gc_thresh", | 3105 | .procname = "gc_thresh", |
3138 | .data = &ipv4_dst_ops.gc_thresh, | 3106 | .data = &ipv4_dst_ops.gc_thresh, |
3139 | .maxlen = sizeof(int), | 3107 | .maxlen = sizeof(int), |
@@ -3141,7 +3109,6 @@ static ctl_table ipv4_route_table[] = { | |||
3141 | .proc_handler = proc_dointvec, | 3109 | .proc_handler = proc_dointvec, |
3142 | }, | 3110 | }, |
3143 | { | 3111 | { |
3144 | .ctl_name = NET_IPV4_ROUTE_MAX_SIZE, | ||
3145 | .procname = "max_size", | 3112 | .procname = "max_size", |
3146 | .data = &ip_rt_max_size, | 3113 | .data = &ip_rt_max_size, |
3147 | .maxlen = sizeof(int), | 3114 | .maxlen = sizeof(int), |
@@ -3151,43 +3118,34 @@ static ctl_table ipv4_route_table[] = { | |||
3151 | { | 3118 | { |
3152 | /* Deprecated. Use gc_min_interval_ms */ | 3119 | /* Deprecated. Use gc_min_interval_ms */ |
3153 | 3120 | ||
3154 | .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL, | ||
3155 | .procname = "gc_min_interval", | 3121 | .procname = "gc_min_interval", |
3156 | .data = &ip_rt_gc_min_interval, | 3122 | .data = &ip_rt_gc_min_interval, |
3157 | .maxlen = sizeof(int), | 3123 | .maxlen = sizeof(int), |
3158 | .mode = 0644, | 3124 | .mode = 0644, |
3159 | .proc_handler = proc_dointvec_jiffies, | 3125 | .proc_handler = proc_dointvec_jiffies, |
3160 | .strategy = sysctl_jiffies, | ||
3161 | }, | 3126 | }, |
3162 | { | 3127 | { |
3163 | .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, | ||
3164 | .procname = "gc_min_interval_ms", | 3128 | .procname = "gc_min_interval_ms", |
3165 | .data = &ip_rt_gc_min_interval, | 3129 | .data = &ip_rt_gc_min_interval, |
3166 | .maxlen = sizeof(int), | 3130 | .maxlen = sizeof(int), |
3167 | .mode = 0644, | 3131 | .mode = 0644, |
3168 | .proc_handler = proc_dointvec_ms_jiffies, | 3132 | .proc_handler = proc_dointvec_ms_jiffies, |
3169 | .strategy = sysctl_ms_jiffies, | ||
3170 | }, | 3133 | }, |
3171 | { | 3134 | { |
3172 | .ctl_name = NET_IPV4_ROUTE_GC_TIMEOUT, | ||
3173 | .procname = "gc_timeout", | 3135 | .procname = "gc_timeout", |
3174 | .data = &ip_rt_gc_timeout, | 3136 | .data = &ip_rt_gc_timeout, |
3175 | .maxlen = sizeof(int), | 3137 | .maxlen = sizeof(int), |
3176 | .mode = 0644, | 3138 | .mode = 0644, |
3177 | .proc_handler = proc_dointvec_jiffies, | 3139 | .proc_handler = proc_dointvec_jiffies, |
3178 | .strategy = sysctl_jiffies, | ||
3179 | }, | 3140 | }, |
3180 | { | 3141 | { |
3181 | .ctl_name = NET_IPV4_ROUTE_GC_INTERVAL, | ||
3182 | .procname = "gc_interval", | 3142 | .procname = "gc_interval", |
3183 | .data = &ip_rt_gc_interval, | 3143 | .data = &ip_rt_gc_interval, |
3184 | .maxlen = sizeof(int), | 3144 | .maxlen = sizeof(int), |
3185 | .mode = 0644, | 3145 | .mode = 0644, |
3186 | .proc_handler = proc_dointvec_jiffies, | 3146 | .proc_handler = proc_dointvec_jiffies, |
3187 | .strategy = sysctl_jiffies, | ||
3188 | }, | 3147 | }, |
3189 | { | 3148 | { |
3190 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_LOAD, | ||
3191 | .procname = "redirect_load", | 3149 | .procname = "redirect_load", |
3192 | .data = &ip_rt_redirect_load, | 3150 | .data = &ip_rt_redirect_load, |
3193 | .maxlen = sizeof(int), | 3151 | .maxlen = sizeof(int), |
@@ -3195,7 +3153,6 @@ static ctl_table ipv4_route_table[] = { | |||
3195 | .proc_handler = proc_dointvec, | 3153 | .proc_handler = proc_dointvec, |
3196 | }, | 3154 | }, |
3197 | { | 3155 | { |
3198 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_NUMBER, | ||
3199 | .procname = "redirect_number", | 3156 | .procname = "redirect_number", |
3200 | .data = &ip_rt_redirect_number, | 3157 | .data = &ip_rt_redirect_number, |
3201 | .maxlen = sizeof(int), | 3158 | .maxlen = sizeof(int), |
@@ -3203,7 +3160,6 @@ static ctl_table ipv4_route_table[] = { | |||
3203 | .proc_handler = proc_dointvec, | 3160 | .proc_handler = proc_dointvec, |
3204 | }, | 3161 | }, |
3205 | { | 3162 | { |
3206 | .ctl_name = NET_IPV4_ROUTE_REDIRECT_SILENCE, | ||
3207 | .procname = "redirect_silence", | 3163 | .procname = "redirect_silence", |
3208 | .data = &ip_rt_redirect_silence, | 3164 | .data = &ip_rt_redirect_silence, |
3209 | .maxlen = sizeof(int), | 3165 | .maxlen = sizeof(int), |
@@ -3211,7 +3167,6 @@ static ctl_table ipv4_route_table[] = { | |||
3211 | .proc_handler = proc_dointvec, | 3167 | .proc_handler = proc_dointvec, |
3212 | }, | 3168 | }, |
3213 | { | 3169 | { |
3214 | .ctl_name = NET_IPV4_ROUTE_ERROR_COST, | ||
3215 | .procname = "error_cost", | 3170 | .procname = "error_cost", |
3216 | .data = &ip_rt_error_cost, | 3171 | .data = &ip_rt_error_cost, |
3217 | .maxlen = sizeof(int), | 3172 | .maxlen = sizeof(int), |
@@ -3219,7 +3174,6 @@ static ctl_table ipv4_route_table[] = { | |||
3219 | .proc_handler = proc_dointvec, | 3174 | .proc_handler = proc_dointvec, |
3220 | }, | 3175 | }, |
3221 | { | 3176 | { |
3222 | .ctl_name = NET_IPV4_ROUTE_ERROR_BURST, | ||
3223 | .procname = "error_burst", | 3177 | .procname = "error_burst", |
3224 | .data = &ip_rt_error_burst, | 3178 | .data = &ip_rt_error_burst, |
3225 | .maxlen = sizeof(int), | 3179 | .maxlen = sizeof(int), |
@@ -3227,7 +3181,6 @@ static ctl_table ipv4_route_table[] = { | |||
3227 | .proc_handler = proc_dointvec, | 3181 | .proc_handler = proc_dointvec, |
3228 | }, | 3182 | }, |
3229 | { | 3183 | { |
3230 | .ctl_name = NET_IPV4_ROUTE_GC_ELASTICITY, | ||
3231 | .procname = "gc_elasticity", | 3184 | .procname = "gc_elasticity", |
3232 | .data = &ip_rt_gc_elasticity, | 3185 | .data = &ip_rt_gc_elasticity, |
3233 | .maxlen = sizeof(int), | 3186 | .maxlen = sizeof(int), |
@@ -3235,16 +3188,13 @@ static ctl_table ipv4_route_table[] = { | |||
3235 | .proc_handler = proc_dointvec, | 3188 | .proc_handler = proc_dointvec, |
3236 | }, | 3189 | }, |
3237 | { | 3190 | { |
3238 | .ctl_name = NET_IPV4_ROUTE_MTU_EXPIRES, | ||
3239 | .procname = "mtu_expires", | 3191 | .procname = "mtu_expires", |
3240 | .data = &ip_rt_mtu_expires, | 3192 | .data = &ip_rt_mtu_expires, |
3241 | .maxlen = sizeof(int), | 3193 | .maxlen = sizeof(int), |
3242 | .mode = 0644, | 3194 | .mode = 0644, |
3243 | .proc_handler = proc_dointvec_jiffies, | 3195 | .proc_handler = proc_dointvec_jiffies, |
3244 | .strategy = sysctl_jiffies, | ||
3245 | }, | 3196 | }, |
3246 | { | 3197 | { |
3247 | .ctl_name = NET_IPV4_ROUTE_MIN_PMTU, | ||
3248 | .procname = "min_pmtu", | 3198 | .procname = "min_pmtu", |
3249 | .data = &ip_rt_min_pmtu, | 3199 | .data = &ip_rt_min_pmtu, |
3250 | .maxlen = sizeof(int), | 3200 | .maxlen = sizeof(int), |
@@ -3252,7 +3202,6 @@ static ctl_table ipv4_route_table[] = { | |||
3252 | .proc_handler = proc_dointvec, | 3202 | .proc_handler = proc_dointvec, |
3253 | }, | 3203 | }, |
3254 | { | 3204 | { |
3255 | .ctl_name = NET_IPV4_ROUTE_MIN_ADVMSS, | ||
3256 | .procname = "min_adv_mss", | 3205 | .procname = "min_adv_mss", |
3257 | .data = &ip_rt_min_advmss, | 3206 | .data = &ip_rt_min_advmss, |
3258 | .maxlen = sizeof(int), | 3207 | .maxlen = sizeof(int), |
@@ -3260,50 +3209,46 @@ static ctl_table ipv4_route_table[] = { | |||
3260 | .proc_handler = proc_dointvec, | 3209 | .proc_handler = proc_dointvec, |
3261 | }, | 3210 | }, |
3262 | { | 3211 | { |
3263 | .ctl_name = NET_IPV4_ROUTE_SECRET_INTERVAL, | ||
3264 | .procname = "secret_interval", | 3212 | .procname = "secret_interval", |
3265 | .data = &ip_rt_secret_interval, | 3213 | .data = &ip_rt_secret_interval, |
3266 | .maxlen = sizeof(int), | 3214 | .maxlen = sizeof(int), |
3267 | .mode = 0644, | 3215 | .mode = 0644, |
3268 | .proc_handler = ipv4_sysctl_rt_secret_interval, | 3216 | .proc_handler = ipv4_sysctl_rt_secret_interval, |
3269 | .strategy = ipv4_sysctl_rt_secret_interval_strategy, | ||
3270 | }, | 3217 | }, |
3271 | { .ctl_name = 0 } | 3218 | { } |
3272 | }; | 3219 | }; |
3273 | 3220 | ||
3274 | static struct ctl_table empty[1]; | 3221 | static struct ctl_table empty[1]; |
3275 | 3222 | ||
3276 | static struct ctl_table ipv4_skeleton[] = | 3223 | static struct ctl_table ipv4_skeleton[] = |
3277 | { | 3224 | { |
3278 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, | 3225 | { .procname = "route", |
3279 | .mode = 0555, .child = ipv4_route_table}, | 3226 | .mode = 0555, .child = ipv4_route_table}, |
3280 | { .procname = "neigh", .ctl_name = NET_IPV4_NEIGH, | 3227 | { .procname = "neigh", |
3281 | .mode = 0555, .child = empty}, | 3228 | .mode = 0555, .child = empty}, |
3282 | { } | 3229 | { } |
3283 | }; | 3230 | }; |
3284 | 3231 | ||
3285 | static __net_initdata struct ctl_path ipv4_path[] = { | 3232 | static __net_initdata struct ctl_path ipv4_path[] = { |
3286 | { .procname = "net", .ctl_name = CTL_NET, }, | 3233 | { .procname = "net", }, |
3287 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, | 3234 | { .procname = "ipv4", }, |
3288 | { }, | 3235 | { }, |
3289 | }; | 3236 | }; |
3290 | 3237 | ||
3291 | static struct ctl_table ipv4_route_flush_table[] = { | 3238 | static struct ctl_table ipv4_route_flush_table[] = { |
3292 | { | 3239 | { |
3293 | .ctl_name = NET_IPV4_ROUTE_FLUSH, | ||
3294 | .procname = "flush", | 3240 | .procname = "flush", |
3295 | .maxlen = sizeof(int), | 3241 | .maxlen = sizeof(int), |
3296 | .mode = 0200, | 3242 | .mode = 0200, |
3297 | .proc_handler = ipv4_sysctl_rtcache_flush, | 3243 | .proc_handler = ipv4_sysctl_rtcache_flush, |
3298 | .strategy = ipv4_sysctl_rtcache_flush_strategy, | ||
3299 | }, | 3244 | }, |
3300 | { .ctl_name = 0 }, | 3245 | { }, |
3301 | }; | 3246 | }; |
3302 | 3247 | ||
3303 | static __net_initdata struct ctl_path ipv4_route_path[] = { | 3248 | static __net_initdata struct ctl_path ipv4_route_path[] = { |
3304 | { .procname = "net", .ctl_name = CTL_NET, }, | 3249 | { .procname = "net", }, |
3305 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, | 3250 | { .procname = "ipv4", }, |
3306 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, }, | 3251 | { .procname = "route", }, |
3307 | { }, | 3252 | { }, |
3308 | }; | 3253 | }; |
3309 | 3254 | ||