Index: usr.sbin/arp/arp.8 =================================================================== --- usr.sbin/arp/arp.8 +++ usr.sbin/arp/arp.8 @@ -28,7 +28,7 @@ .\" @(#)arp.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 13, 2020 +.Dd August 2, 2021 .Dt ARP 8 .Os .Sh NAME @@ -37,12 +37,12 @@ .Sh SYNOPSIS .Nm .Op Fl -libxo Ar options -.Op Fl n +.Op Fl Dn .Op Fl i Ar interface .Ar hostname .Nm .Op Fl -libxo Ar options -.Op Fl n +.Op Fl Dn .Op Fl i Ar interface .Fl a .Nm @@ -92,6 +92,10 @@ flag, deletes all of the current .Tn ARP entries. +.It Fl D +Display route cache statistics for each +.Tn ARP +entry. .It Fl d A super-user may delete an entry for the host called .Ar hostname Index: usr.sbin/arp/arp.c =================================================================== --- usr.sbin/arp/arp.c +++ usr.sbin/arp/arp.c @@ -100,6 +100,7 @@ static int valid_type(int type); static int nflag; /* no reverse dns lookups */ +static int Dflag; static char *rifname; static time_t expire_time; @@ -129,11 +130,14 @@ if (argc < 0) exit(1); - while ((ch = getopt(argc, argv, "andfsSi:")) != -1) + while ((ch = getopt(argc, argv, "andDfsSi:")) != -1) switch(ch) { case 'a': aflag = 1; break; + case 'D': + Dflag = 1; + break; case 'd': SETFUNC(F_DELETE); break; @@ -677,6 +681,11 @@ break; } + if (Dflag) { + xo_emit(" lookup-count {:lookup-count/%lu}", rtm->rtm_rmx.rmx_recvpipe); + xo_emit(" cache-hit {:cache-hit/%lu}", rtm->rtm_rmx.rmx_sendpipe); + } + xo_emit("\n"); xo_close_instance("arp-cache");