diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-10-18 06:05:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:22 -0400 |
commit | d12af679bcf8995a237560bdf7a4d734f8df5dbb (patch) | |
tree | 9cb821d20fa8be39ff4954d7e8f5966ef9d3b7dd | |
parent | f5ead5cefc1129d5f001728004ed0f38d5875c02 (diff) |
sysctl: fix neighbour table sysctls.
- In ipv6 ndisc_ifinfo_syctl_change so it doesn't depend on binary
sysctl names for a function that works with proc.
- In neighbour.c reorder the table to put the possibly unused entries
at the end so we can remove them by terminating the table early.
- In neighbour.c kill the entries with questionable binary sysctl
handling behavior.
- In neighbour.c if we don't have a strategy routine remove the
binary path. So we don't the default sysctl strategy routine
on data that is not ready for it.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@sw.ru>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | net/core/neighbour.c | 75 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 24 |
2 files changed, 49 insertions, 50 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index cd3af59b38a1..67ba9914e52e 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2496,7 +2496,6 @@ static struct neigh_sysctl_table { | |||
2496 | .proc_handler = &proc_dointvec, | 2496 | .proc_handler = &proc_dointvec, |
2497 | }, | 2497 | }, |
2498 | { | 2498 | { |
2499 | .ctl_name = NET_NEIGH_RETRANS_TIME, | ||
2500 | .procname = "retrans_time", | 2499 | .procname = "retrans_time", |
2501 | .maxlen = sizeof(int), | 2500 | .maxlen = sizeof(int), |
2502 | .mode = 0644, | 2501 | .mode = 0644, |
@@ -2541,27 +2540,40 @@ static struct neigh_sysctl_table { | |||
2541 | .proc_handler = &proc_dointvec, | 2540 | .proc_handler = &proc_dointvec, |
2542 | }, | 2541 | }, |
2543 | { | 2542 | { |
2544 | .ctl_name = NET_NEIGH_ANYCAST_DELAY, | ||
2545 | .procname = "anycast_delay", | 2543 | .procname = "anycast_delay", |
2546 | .maxlen = sizeof(int), | 2544 | .maxlen = sizeof(int), |
2547 | .mode = 0644, | 2545 | .mode = 0644, |
2548 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2546 | .proc_handler = &proc_dointvec_userhz_jiffies, |
2549 | }, | 2547 | }, |
2550 | { | 2548 | { |
2551 | .ctl_name = NET_NEIGH_PROXY_DELAY, | ||
2552 | .procname = "proxy_delay", | 2549 | .procname = "proxy_delay", |
2553 | .maxlen = sizeof(int), | 2550 | .maxlen = sizeof(int), |
2554 | .mode = 0644, | 2551 | .mode = 0644, |
2555 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2552 | .proc_handler = &proc_dointvec_userhz_jiffies, |
2556 | }, | 2553 | }, |
2557 | { | 2554 | { |
2558 | .ctl_name = NET_NEIGH_LOCKTIME, | ||
2559 | .procname = "locktime", | 2555 | .procname = "locktime", |
2560 | .maxlen = sizeof(int), | 2556 | .maxlen = sizeof(int), |
2561 | .mode = 0644, | 2557 | .mode = 0644, |
2562 | .proc_handler = &proc_dointvec_userhz_jiffies, | 2558 | .proc_handler = &proc_dointvec_userhz_jiffies, |
2563 | }, | 2559 | }, |
2564 | { | 2560 | { |
2561 | .ctl_name = NET_NEIGH_RETRANS_TIME_MS, | ||
2562 | .procname = "retrans_time_ms", | ||
2563 | .maxlen = sizeof(int), | ||
2564 | .mode = 0644, | ||
2565 | .proc_handler = &proc_dointvec_ms_jiffies, | ||
2566 | .strategy = &sysctl_ms_jiffies, | ||
2567 | }, | ||
2568 | { | ||
2569 | .ctl_name = NET_NEIGH_REACHABLE_TIME_MS, | ||
2570 | .procname = "base_reachable_time_ms", | ||
2571 | .maxlen = sizeof(int), | ||
2572 | .mode = 0644, | ||
2573 | .proc_handler = &proc_dointvec_ms_jiffies, | ||
2574 | .strategy = &sysctl_ms_jiffies, | ||
2575 | }, | ||
2576 | { | ||
2565 | .ctl_name = NET_NEIGH_GC_INTERVAL, | 2577 | .ctl_name = NET_NEIGH_GC_INTERVAL, |
2566 | .procname = "gc_interval", | 2578 | .procname = "gc_interval", |
2567 | .maxlen = sizeof(int), | 2579 | .maxlen = sizeof(int), |
@@ -2590,22 +2602,7 @@ static struct neigh_sysctl_table { | |||
2590 | .mode = 0644, | 2602 | .mode = 0644, |
2591 | .proc_handler = &proc_dointvec, | 2603 | .proc_handler = &proc_dointvec, |
2592 | }, | 2604 | }, |
2593 | { | 2605 | {} |
2594 | .ctl_name = NET_NEIGH_RETRANS_TIME_MS, | ||
2595 | .procname = "retrans_time_ms", | ||
2596 | .maxlen = sizeof(int), | ||
2597 | .mode = 0644, | ||
2598 | .proc_handler = &proc_dointvec_ms_jiffies, | ||
2599 | .strategy = &sysctl_ms_jiffies, | ||
2600 | }, | ||
2601 | { | ||
2602 | .ctl_name = NET_NEIGH_REACHABLE_TIME_MS, | ||
2603 | .procname = "base_reachable_time_ms", | ||
2604 | .maxlen = sizeof(int), | ||
2605 | .mode = 0644, | ||
2606 | .proc_handler = &proc_dointvec_ms_jiffies, | ||
2607 | .strategy = &sysctl_ms_jiffies, | ||
2608 | }, | ||
2609 | }, | 2606 | }, |
2610 | .neigh_dev = { | 2607 | .neigh_dev = { |
2611 | { | 2608 | { |
@@ -2658,42 +2655,48 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
2658 | t->neigh_vars[9].data = &p->anycast_delay; | 2655 | t->neigh_vars[9].data = &p->anycast_delay; |
2659 | t->neigh_vars[10].data = &p->proxy_delay; | 2656 | t->neigh_vars[10].data = &p->proxy_delay; |
2660 | t->neigh_vars[11].data = &p->locktime; | 2657 | t->neigh_vars[11].data = &p->locktime; |
2658 | t->neigh_vars[12].data = &p->retrans_time; | ||
2659 | t->neigh_vars[13].data = &p->base_reachable_time; | ||
2661 | 2660 | ||
2662 | if (dev) { | 2661 | if (dev) { |
2663 | dev_name_source = dev->name; | 2662 | dev_name_source = dev->name; |
2664 | t->neigh_dev[0].ctl_name = dev->ifindex; | 2663 | t->neigh_dev[0].ctl_name = dev->ifindex; |
2665 | t->neigh_vars[12].procname = NULL; | 2664 | /* Terminate the table early */ |
2666 | t->neigh_vars[13].procname = NULL; | 2665 | memset(&t->neigh_vars[14], 0, sizeof(t->neigh_vars[14])); |
2667 | t->neigh_vars[14].procname = NULL; | ||
2668 | t->neigh_vars[15].procname = NULL; | ||
2669 | } else { | 2666 | } else { |
2670 | dev_name_source = t->neigh_dev[0].procname; | 2667 | dev_name_source = t->neigh_dev[0].procname; |
2671 | t->neigh_vars[12].data = (int *)(p + 1); | 2668 | t->neigh_vars[14].data = (int *)(p + 1); |
2672 | t->neigh_vars[13].data = (int *)(p + 1) + 1; | 2669 | t->neigh_vars[15].data = (int *)(p + 1) + 1; |
2673 | t->neigh_vars[14].data = (int *)(p + 1) + 2; | 2670 | t->neigh_vars[16].data = (int *)(p + 1) + 2; |
2674 | t->neigh_vars[15].data = (int *)(p + 1) + 3; | 2671 | t->neigh_vars[17].data = (int *)(p + 1) + 3; |
2675 | } | 2672 | } |
2676 | 2673 | ||
2677 | t->neigh_vars[16].data = &p->retrans_time; | ||
2678 | t->neigh_vars[17].data = &p->base_reachable_time; | ||
2679 | 2674 | ||
2680 | if (handler || strategy) { | 2675 | if (handler || strategy) { |
2681 | /* RetransTime */ | 2676 | /* RetransTime */ |
2682 | t->neigh_vars[3].proc_handler = handler; | 2677 | t->neigh_vars[3].proc_handler = handler; |
2683 | t->neigh_vars[3].strategy = strategy; | 2678 | t->neigh_vars[3].strategy = strategy; |
2684 | t->neigh_vars[3].extra1 = dev; | 2679 | t->neigh_vars[3].extra1 = dev; |
2680 | if (!strategy) | ||
2681 | t->neigh_vars[3].ctl_name = CTL_UNNUMBERED; | ||
2685 | /* ReachableTime */ | 2682 | /* ReachableTime */ |
2686 | t->neigh_vars[4].proc_handler = handler; | 2683 | t->neigh_vars[4].proc_handler = handler; |
2687 | t->neigh_vars[4].strategy = strategy; | 2684 | t->neigh_vars[4].strategy = strategy; |
2688 | t->neigh_vars[4].extra1 = dev; | 2685 | t->neigh_vars[4].extra1 = dev; |
2686 | if (!strategy) | ||
2687 | t->neigh_vars[4].ctl_name = CTL_UNNUMBERED; | ||
2689 | /* RetransTime (in milliseconds)*/ | 2688 | /* RetransTime (in milliseconds)*/ |
2690 | t->neigh_vars[16].proc_handler = handler; | 2689 | t->neigh_vars[12].proc_handler = handler; |
2691 | t->neigh_vars[16].strategy = strategy; | 2690 | t->neigh_vars[12].strategy = strategy; |
2692 | t->neigh_vars[16].extra1 = dev; | 2691 | t->neigh_vars[12].extra1 = dev; |
2692 | if (!strategy) | ||
2693 | t->neigh_vars[12].ctl_name = CTL_UNNUMBERED; | ||
2693 | /* ReachableTime (in milliseconds) */ | 2694 | /* ReachableTime (in milliseconds) */ |
2694 | t->neigh_vars[17].proc_handler = handler; | 2695 | t->neigh_vars[13].proc_handler = handler; |
2695 | t->neigh_vars[17].strategy = strategy; | 2696 | t->neigh_vars[13].strategy = strategy; |
2696 | t->neigh_vars[17].extra1 = dev; | 2697 | t->neigh_vars[13].extra1 = dev; |
2698 | if (!strategy) | ||
2699 | t->neigh_vars[13].ctl_name = CTL_UNNUMBERED; | ||
2697 | } | 2700 | } |
2698 | 2701 | ||
2699 | dev_name = kstrdup(dev_name_source, GFP_KERNEL); | 2702 | dev_name = kstrdup(dev_name_source, GFP_KERNEL); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 6cc33dc83d1c..20cfc90d5597 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1658,30 +1658,26 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f | |||
1658 | struct inet6_dev *idev; | 1658 | struct inet6_dev *idev; |
1659 | int ret; | 1659 | int ret; |
1660 | 1660 | ||
1661 | if (ctl->ctl_name == NET_NEIGH_RETRANS_TIME || | 1661 | if ((strcmp(ctl->procname, "retrans_time") == 0) || |
1662 | ctl->ctl_name == NET_NEIGH_REACHABLE_TIME) | 1662 | (strcmp(ctl->procname, "base_reachable_time") == 0)) |
1663 | ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default"); | 1663 | ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default"); |
1664 | 1664 | ||
1665 | switch (ctl->ctl_name) { | 1665 | if (strcmp(ctl->procname, "retrans_time") == 0) |
1666 | case NET_NEIGH_RETRANS_TIME: | ||
1667 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 1666 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); |
1668 | break; | 1667 | |
1669 | case NET_NEIGH_REACHABLE_TIME: | 1668 | else if (strcmp(ctl->procname, "base_reachable_time") == 0) |
1670 | ret = proc_dointvec_jiffies(ctl, write, | 1669 | ret = proc_dointvec_jiffies(ctl, write, |
1671 | filp, buffer, lenp, ppos); | 1670 | filp, buffer, lenp, ppos); |
1672 | break; | 1671 | |
1673 | case NET_NEIGH_RETRANS_TIME_MS: | 1672 | else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) || |
1674 | case NET_NEIGH_REACHABLE_TIME_MS: | 1673 | (strcmp(ctl->procname, "base_reacable_time_ms") == 0)) |
1675 | ret = proc_dointvec_ms_jiffies(ctl, write, | 1674 | ret = proc_dointvec_ms_jiffies(ctl, write, |
1676 | filp, buffer, lenp, ppos); | 1675 | filp, buffer, lenp, ppos); |
1677 | break; | 1676 | else |
1678 | default: | ||
1679 | ret = -1; | 1677 | ret = -1; |
1680 | } | ||
1681 | 1678 | ||
1682 | if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) { | 1679 | if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) { |
1683 | if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME || | 1680 | if (ctl->data == &idev->nd_parms->base_reachable_time) |
1684 | ctl->ctl_name == NET_NEIGH_REACHABLE_TIME_MS) | ||
1685 | idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); | 1681 | idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); |
1686 | idev->tstamp = jiffies; | 1682 | idev->tstamp = jiffies; |
1687 | inet6_ifinfo_notify(RTM_NEWLINK, idev); | 1683 | inet6_ifinfo_notify(RTM_NEWLINK, idev); |