diff options
author | Oleg Bulyzhin <oleg@FreeBSD.org> | 2006-07-06 00:24:36 +0000 |
---|---|---|
committer | Oleg Bulyzhin <oleg@FreeBSD.org> | 2006-07-06 00:24:36 +0000 |
commit | e27c3f48fba8604cc2911289099d9d763b19bf93 (patch) | |
tree | 6b5d74f7c6e9d7e3bf10dd2d9ae4746fb93f13b1 /sys/net/rtsock.c | |
parent | 6372145725eca590471a905f637cd5cf9e76b1b2 (diff) | |
download | src-e27c3f48fba8604cc2911289099d9d763b19bf93.tar.gz src-e27c3f48fba8604cc2911289099d9d763b19bf93.zip |
Adjust rt_(set|get)metrics() to do kernel <-> userland timebase conversion.
We need it since kernel timebase has changed (time_second -> time_uptime).
Approved by: glebius (mentor)
Notes
Notes:
svn path=/head/; revision=160124
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 701662d24146..76913a57085d 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -605,7 +605,10 @@ rt_setmetrics(u_long which, const struct rt_metrics *in, * of tcp hostcache. The rest is ignored. */ metric(RTV_MTU, rmx_mtu); - metric(RTV_EXPIRE, rmx_expire); + /* Userland -> kernel timebase conversion. */ + if (which & RTV_EXPIRE) + out->rmx_expire = in->rmx_expire ? + in->rmx_expire - time_second + time_uptime : 0; #undef metric } @@ -615,7 +618,9 @@ rt_getmetrics(const struct rt_metrics_lite *in, struct rt_metrics *out) #define metric(e) out->e = in->e; bzero(out, sizeof(*out)); metric(rmx_mtu); - metric(rmx_expire); + /* Kernel -> userland timebase conversion. */ + out->rmx_expire = in->rmx_expire ? + in->rmx_expire - time_uptime + time_second : 0; #undef metric } |