Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2010 23:27:53 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r216075 - in head: sys/netinet usr.sbin/arp
Message-ID:  <20101130222753.GA93292@stack.nl>
In-Reply-To: <201011301557.oAUFv0TC007320@svn.freebsd.org>
References:  <201011301557.oAUFv0TC007320@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101130222753.GA93292>