svn commit: r216075 - in head: sys/netinet usr.sbin/arp
Jilles Tjoelker
jilles at stack.nl
Tue Nov 30 22:27:55 UTC 2010
On Tue, Nov 30, 2010 at 03:57:00PM +0000, Gleb Smirnoff wrote:
> Author: glebius
> Date: Tue Nov 30 15:57:00 2010
> New Revision: 216075
> URL: http://svn.freebsd.org/changeset/base/216075
> Log:
> Use time_uptime instead of non-monotonic time_second to drive ARP
> timeouts.
> Suggested by: bde
> Modified:
> head/sys/netinet/if_ether.c
> head/sys/netinet/in.c
> head/usr.sbin/arp/arp.c
> Modified: head/usr.sbin/arp/arp.c
> ==============================================================================
> --- head/usr.sbin/arp/arp.c Tue Nov 30 09:34:47 2010 (r216074)
> +++ head/usr.sbin/arp/arp.c Tue Nov 30 15:57:00 2010 (r216075)
> @@ -602,10 +602,10 @@ print_entry(struct sockaddr_dl *sdl,
> if (rtm->rtm_rmx.rmx_expire == 0)
> printf(" permanent");
> else {
> - static struct timeval tv;
> - if (tv.tv_sec == 0)
> - gettimeofday(&tv, 0);
> - if ((expire_time = rtm->rtm_rmx.rmx_expire - tv.tv_sec) > 0)
> + static struct timespec tp;
> + if (tp.tv_sec == 0)
> + clock_gettime(CLOCK_MONOTONIC, &tp);
> + if ((expire_time = rtm->rtm_rmx.rmx_expire - tp.tv_sec) > 0)
> printf(" expires in %d seconds", (int)expire_time);
> else
> printf(" expired");
Hmm, doesn't this break the API between arp(8) and the kernel?
Assuming we care, perhaps arp(8) should send/receive realtime, converted
at the time it requests the data. The kernel can then continue to use
monotonic time internally (which I agree is better).
--
Jilles Tjoelker
More information about the svn-src-head
mailing list