summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authoroleg <oleg@FreeBSD.org>2006-07-06 00:24:36 +0000
committeroleg <oleg@FreeBSD.org>2006-07-06 00:24:36 +0000
commit6cf0e874f459a2739d9c59ec7b35f62d8121b9b5 (patch)
tree6b5d74f7c6e9d7e3bf10dd2d9ae4746fb93f13b1 /sys/net
parente6e6ae67a213d47300638220366b4b14548489d3 (diff)
downloadFreeBSD-src-6cf0e874f459a2739d9c59ec7b35f62d8121b9b5.zip
FreeBSD-src-6cf0e874f459a2739d9c59ec7b35f62d8121b9b5.tar.gz
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)
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/rtsock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 701662d..76913a5 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
}
OpenPOWER on IntegriCloud