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