Commit 42ed4aad authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji

[NET] NEIGHBOUR: Add retrans_time_ms and reachable_time_ms sysctls.

Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
parent ea3b8835
...@@ -1754,18 +1754,25 @@ settings contain additional options to set garbage collection parameters. ...@@ -1754,18 +1754,25 @@ settings contain additional options to set garbage collection parameters.
In the interface directories you'll find the following entries: In the interface directories you'll find the following entries:
base_reachable_time base_reachable_time, base_reachable_time_ms
------------------- -------------------------------------------
A base value used for computing the random reachable time value as specified A base value used for computing the random reachable time value as specified
in RFC2461. in RFC2461.
retrans_time Expression of base_reachable_time is in seconds.
------------ Expression of base_reachable_time_ms is in milliseconds.
retrans_time, retrans_time_ms
-----------------------------
The time between retransmitted Neighbor Solicitation messages.
Used for address resolution and to determine if a neighbor is
unreachable.
The time, expressed in jiffies (1/100 sec), between retransmitted Neighbor Expression of retrans_time is in 1/100 seconds (for IPv4) or in jiffies
Solicitation messages. Used for address resolution and to determine if a (for IPv6).
neighbor is unreachable. Expression of retrans_time_ms is in milliseconds.
unres_qlen unres_qlen
---------- ----------
......
...@@ -501,7 +501,10 @@ enum { ...@@ -501,7 +501,10 @@ enum {
NET_NEIGH_GC_INTERVAL=13, NET_NEIGH_GC_INTERVAL=13,
NET_NEIGH_GC_THRESH1=14, NET_NEIGH_GC_THRESH1=14,
NET_NEIGH_GC_THRESH2=15, NET_NEIGH_GC_THRESH2=15,
NET_NEIGH_GC_THRESH3=16 NET_NEIGH_GC_THRESH3=16,
NET_NEIGH_RETRANS_TIME_MS=17,
NET_NEIGH_REACHABLE_TIME_MS=18,
__NET_NEIGH_MAX
}; };
/* /proc/sys/net/ipx */ /* /proc/sys/net/ipx */
......
...@@ -2047,7 +2047,7 @@ static void neigh_app_notify(struct neighbour *n) ...@@ -2047,7 +2047,7 @@ static void neigh_app_notify(struct neighbour *n)
static struct neigh_sysctl_table { static struct neigh_sysctl_table {
struct ctl_table_header *sysctl_header; struct ctl_table_header *sysctl_header;
ctl_table neigh_vars[17]; ctl_table neigh_vars[__NET_NEIGH_MAX];
ctl_table neigh_dev[2]; ctl_table neigh_dev[2];
ctl_table neigh_neigh_dir[2]; ctl_table neigh_neigh_dir[2];
ctl_table neigh_proto_dir[2]; ctl_table neigh_proto_dir[2];
...@@ -2170,6 +2170,22 @@ static struct neigh_sysctl_table { ...@@ -2170,6 +2170,22 @@ static struct neigh_sysctl_table {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
}, },
{
.ctl_name = NET_NEIGH_RETRANS_TIME_MS,
.procname = "retrans_time_ms",
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_ms_jiffies,
.strategy = &sysctl_ms_jiffies,
},
{
.ctl_name = NET_NEIGH_REACHABLE_TIME_MS,
.procname = "base_reachable_time_ms",
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_ms_jiffies,
.strategy = &sysctl_ms_jiffies,
},
}, },
.neigh_dev = { .neigh_dev = {
{ {
...@@ -2214,16 +2230,6 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, ...@@ -2214,16 +2230,6 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
t->neigh_vars[1].data = &p->ucast_probes; t->neigh_vars[1].data = &p->ucast_probes;
t->neigh_vars[2].data = &p->app_probes; t->neigh_vars[2].data = &p->app_probes;
t->neigh_vars[3].data = &p->retrans_time; t->neigh_vars[3].data = &p->retrans_time;
if (handler || strategy) {
/* RetransTime */
t->neigh_vars[3].proc_handler = handler;
t->neigh_vars[3].strategy = strategy;
t->neigh_vars[3].extra1 = dev;
/* ReachableTime */
t->neigh_vars[4].proc_handler = handler;
t->neigh_vars[4].strategy = strategy;
t->neigh_vars[4].extra1 = dev;
}
t->neigh_vars[4].data = &p->base_reachable_time; t->neigh_vars[4].data = &p->base_reachable_time;
t->neigh_vars[5].data = &p->delay_probe_time; t->neigh_vars[5].data = &p->delay_probe_time;
t->neigh_vars[6].data = &p->gc_staletime; t->neigh_vars[6].data = &p->gc_staletime;
...@@ -2233,18 +2239,43 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, ...@@ -2233,18 +2239,43 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
t->neigh_vars[10].data = &p->proxy_delay; t->neigh_vars[10].data = &p->proxy_delay;
t->neigh_vars[11].data = &p->locktime; t->neigh_vars[11].data = &p->locktime;
dev_name_source = t->neigh_dev[0].procname;
if (dev) { if (dev) {
dev_name_source = dev->name; dev_name_source = dev->name;
t->neigh_dev[0].ctl_name = dev->ifindex; t->neigh_dev[0].ctl_name = dev->ifindex;
memset(&t->neigh_vars[12], 0, sizeof(ctl_table)); t->neigh_vars[12].procname = NULL;
t->neigh_vars[13].procname = NULL;
t->neigh_vars[14].procname = NULL;
t->neigh_vars[15].procname = NULL;
} else { } else {
dev_name_source = t->neigh_dev[0].procname;
t->neigh_vars[12].data = (int *)(p + 1); t->neigh_vars[12].data = (int *)(p + 1);
t->neigh_vars[13].data = (int *)(p + 1) + 1; t->neigh_vars[13].data = (int *)(p + 1) + 1;
t->neigh_vars[14].data = (int *)(p + 1) + 2; t->neigh_vars[14].data = (int *)(p + 1) + 2;
t->neigh_vars[15].data = (int *)(p + 1) + 3; t->neigh_vars[15].data = (int *)(p + 1) + 3;
} }
t->neigh_vars[16].data = &p->retrans_time;
t->neigh_vars[17].data = &p->base_reachable_time;
if (handler || strategy) {
/* RetransTime */
t->neigh_vars[3].proc_handler = handler;
t->neigh_vars[3].strategy = strategy;
t->neigh_vars[3].extra1 = dev;
/* ReachableTime */
t->neigh_vars[4].proc_handler = handler;
t->neigh_vars[4].strategy = strategy;
t->neigh_vars[4].extra1 = dev;
/* RetransTime (in milliseconds)*/
t->neigh_vars[16].proc_handler = handler;
t->neigh_vars[16].strategy = strategy;
t->neigh_vars[16].extra1 = dev;
/* ReachableTime (in milliseconds) */
t->neigh_vars[17].proc_handler = handler;
t->neigh_vars[17].strategy = strategy;
t->neigh_vars[17].extra1 = dev;
}
dev_name = net_sysctl_strdup(dev_name_source); dev_name = net_sysctl_strdup(dev_name_source);
if (!dev_name) { if (!dev_name) {
err = -ENOBUFS; err = -ENOBUFS;
......
...@@ -1550,12 +1550,18 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f ...@@ -1550,12 +1550,18 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
ret = proc_dointvec_jiffies(ctl, write, ret = proc_dointvec_jiffies(ctl, write,
filp, buffer, lenp, ppos); filp, buffer, lenp, ppos);
break; break;
case NET_NEIGH_RETRANS_TIME_MS:
case NET_NEIGH_REACHABLE_TIME_MS:
ret = proc_dointvec_ms_jiffies(ctl, write,
filp, buffer, lenp, ppos);
break;
default: default:
ret = -1; ret = -1;
} }
if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) { if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) {
if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME) if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME ||
ctl->ctl_name == NET_NEIGH_REACHABLE_TIME_MS)
idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time);
idev->tstamp = jiffies; idev->tstamp = jiffies;
inet6_ifinfo_notify(RTM_NEWLINK, idev); inet6_ifinfo_notify(RTM_NEWLINK, idev);
...@@ -1579,13 +1585,20 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, int nlen, ...@@ -1579,13 +1585,20 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, int nlen,
oldval, oldlenp, newval, newlen, oldval, oldlenp, newval, newlen,
context); context);
break; break;
case NET_NEIGH_RETRANS_TIME_MS:
case NET_NEIGH_REACHABLE_TIME_MS:
ret = sysctl_ms_jiffies(ctl, name, nlen,
oldval, oldlenp, newval, newlen,
context);
break;
default: default:
ret = 0; ret = 0;
} }
if (newval && newlen && ret > 0 && if (newval && newlen && ret > 0 &&
dev && (idev = in6_dev_get(dev)) != NULL) { dev && (idev = in6_dev_get(dev)) != NULL) {
if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME) if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME ||
ctl->ctl_name == NET_NEIGH_REACHABLE_TIME_MS)
idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time);
idev->tstamp = jiffies; idev->tstamp = jiffies;
inet6_ifinfo_notify(RTM_NEWLINK, idev); inet6_ifinfo_notify(RTM_NEWLINK, idev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment