summaryrefslogtreecommitdiff
path: root/usr.sbin/arp
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2010-02-15 14:29:17 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2010-02-15 14:29:17 +0000
commit929683056e3a066013eca29ebc227072e6a24b61 (patch)
tree041ff7daaf7a41f0be203c1ed3527961b47c9681 /usr.sbin/arp
parent96aad9c0130e17369b954792ea207d6119fdbb52 (diff)
downloadsrc-test2-929683056e3a066013eca29ebc227072e6a24b61.tar.gz
src-test2-929683056e3a066013eca29ebc227072e6a24b61.zip
Show when an ARP entry expires.
MFC after: 1 week
Notes
Notes: svn path=/head/; revision=203919
Diffstat (limited to 'usr.sbin/arp')
-rw-r--r--usr.sbin/arp/arp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 61427d34c81f..a0e228ce3656 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -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)