Date: Mon, 22 Feb 2010 16:00:55 +0000 (UTC) From: Ruslan Ermilov <ru@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r204204 - stable/8/usr.sbin/arp Message-ID: <201002221600.o1MG0tUY090487@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ru Date: Mon Feb 22 16:00:55 2010 New Revision: 204204 URL: http://svn.freebsd.org/changeset/base/204204 Log: MFC: r203919: Show when an ARP entry expires (now that this info cannot be obtained with netstat(1)). Modified: stable/8/usr.sbin/arp/arp.c Directory Properties: stable/8/usr.sbin/arp/ (props changed) Modified: stable/8/usr.sbin/arp/arp.c ============================================================================== --- stable/8/usr.sbin/arp/arp.c Mon Feb 22 15:58:10 2010 (r204203) +++ stable/8/usr.sbin/arp/arp.c Mon Feb 22 16:00:55 2010 (r204204) @@ -101,7 +101,8 @@ static int valid_type(int type); static int nflag; /* no reverse dns lookups */ static char *rifname; -static int expire_time, flags, doing_proxy, proxy_only; +static time_t expire_time; +static int flags, doing_proxy, proxy_only; /* which function we're supposed to do */ #define F_GET 1 @@ -594,6 +595,15 @@ print_entry(struct sockaddr_dl *sdl, printf(" on %s", ifname); 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) + printf(" expires in %d seconds", (int)expire_time); + else + printf(" expired"); + } if (addr->sin_other & SIN_PROXY) printf(" published (proxy only)"); if (rtm->rtm_flags & RTF_ANNOUNCE)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002221600.o1MG0tUY090487>