[radvd-devel-l] [PATCH] retrans_time takes USER_HZ, not seconds.
Pekka Savola
pekkas at netcore.fi
Thu Jan 24 00:37:04 EST 2008
Hi Jim,
On Wed, 23 Jan 2008, Jim Paris wrote:
> Looking at the Linux source, it seems /proc/sys/net/ipv6/neigh/*/retrans_time
> takes units of USER_HZ, not seconds. However, knowing the actual
> USER_HZ from userspace doesn't seem to be easy (sysconf(_SC_CLK_TCK)
> is hardcoded in glibc). This patch (on top of my privsep one)
> changes it to assume USER_HZ=100. Any suggestions on a better way to
> handle it? Being wrong isn't too bad because this only gets used when
> retrans_time_ms doesn't exist, which is <2.6.12 or so.
Thanks. I'm not aware of a better method. I'll change the patch so
that the source defines USER_HZ and it's used in the code instead of
assuming the magic variable 100 (in case someone wants to change it).
> device-linux.c | 4 ++--
> privsep-linux.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/device-linux.c b/device-linux.c
> index b007187..4af1baf 100644
> --- a/device-linux.c
> +++ b/device-linux.c
> @@ -286,7 +286,7 @@ set_interface_reachtime(const char *iface, uint32_t rtime)
> ret = set_interface_var(iface,
> PROC_SYS_IP6_BASEREACHTIME,
> "BaseReachableTimer",
> - rtime / 1000);
> + rtime / 1000); /* sec */
> return ret;
> }
>
> @@ -306,7 +306,7 @@ set_interface_retranstimer(const char *iface, uint32_t rettimer)
> ret = set_interface_var(iface,
> PROC_SYS_IP6_RETRANSTIMER,
> "RetransTimer",
> - rettimer / 1000);
> + rettimer / 10); /* XXX user_hz */
> return ret;
> }
>
> diff --git a/privsep-linux.c b/privsep-linux.c
> index 3007993..28238e2 100644
> --- a/privsep-linux.c
> +++ b/privsep-linux.c
> @@ -82,7 +82,7 @@ privsep_read_loop(void)
> ret = privsep_set(cmd.iface, PROC_SYS_IP6_BASEREACHTIME_MS, cmd.val);
> if (ret == 0)
> break;
> - privsep_set(cmd.iface, PROC_SYS_IP6_BASEREACHTIME, cmd.val / 1000);
> + privsep_set(cmd.iface, PROC_SYS_IP6_BASEREACHTIME, cmd.val / 1000); /* sec */
> break;
>
> case SET_INTERFACE_RETRANSTIMER:
> @@ -91,7 +91,7 @@ privsep_read_loop(void)
> ret = privsep_set(cmd.iface, PROC_SYS_IP6_RETRANSTIMER_MS, cmd.val);
> if (ret == 0)
> break;
> - privsep_set(cmd.iface, PROC_SYS_IP6_RETRANSTIMER, cmd.val / 1000);
> + privsep_set(cmd.iface, PROC_SYS_IP6_RETRANSTIMER, cmd.val / 10); /* XXX user_hz */
> break;
>
> default:
> --
> 1.5.3.4
>
> --
> radvd-devel-l mailing list : radvd-devel-l at litech.org
> http://lists.litech.org/listinfo/radvd-devel-l
>
--
Pekka Savola "You each name yourselves king, yet the
Netcore Oy kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
More information about the radvd-devel-l
mailing list