From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 29 18:30:28 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EF3C1065675 for ; Wed, 29 Jun 2011 18:30:28 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DDAF08FC23 for ; Wed, 29 Jun 2011 18:30:27 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5TIURfM010572 for ; Wed, 29 Jun 2011 18:30:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5TIURVC010564; Wed, 29 Jun 2011 18:30:27 GMT (envelope-from gnats) Resent-Date: Wed, 29 Jun 2011 18:30:27 GMT Resent-Message-Id: <201106291830.p5TIURVC010564@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jille Timmermans Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B89D106564A for ; Wed, 29 Jun 2011 18:28:49 +0000 (UTC) (envelope-from jille@vvs-nijmegen.nl) Received: from smtp6.versatel.nl (smtp6.versatel.nl [62.58.50.97]) by mx1.freebsd.org (Postfix) with ESMTP id D8E648FC0A for ; Wed, 29 Jun 2011 18:28:48 +0000 (UTC) Received: (qmail 2160 invoked by uid 0); 29 Jun 2011 18:02:06 -0000 Received: from ip222-125-174-82.adsl2.static.versatel.nl (HELO dansje.vvs-nijmegen.nl) ([82.174.125.222]) (envelope-sender ) by smtp6.versatel.nl (qmail-ldap-1.03) with SMTP for < >; 29 Jun 2011 18:02:06 -0000 Received: by dansje.vvs-nijmegen.nl (Postfix, from userid 1000) id 1FB8361C65; Wed, 29 Jun 2011 20:03:48 +0200 (CEST) Message-Id: <20110629180348.1FB8361C65@dansje.vvs-nijmegen.nl> Date: Wed, 29 Jun 2011 20:03:48 +0200 (CEST) From: Jille Timmermans To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/158500: Add -p to arp(8) to hide permanent entries X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jille Timmermans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2011 18:30:28 -0000 >Number: 158500 >Category: bin >Synopsis: Add -p to arp(8) to hide permanent entries >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jun 29 18:30:26 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Jille Timmermans >Release: FreeBSD 8.0-STABLE i386 >Organization: >Environment: System: FreeBSD 8.0-STABLE FreeBSD 8.0-STABLE #0 r204041 >Description: I have 36 aliases on my network interfaces which result in 36 permanent arp entries. When I want to see hosts on my network I don't care about the permanent entries, so I'd like an option to hide them. >How-To-Repeat: arp -pa >Fix: --- arp.diff begins here --- Index: arp.c =================================================================== --- arp.c (revision 204041) +++ arp.c (working copy) @@ -99,6 +99,7 @@ static int valid_type(int type); static int nflag; /* no reverse dns lookups */ +static int pflag = 0; /* hide permanemt entries */ static char *rifname; static int expire_time, flags, doing_proxy, proxy_only; @@ -119,7 +120,7 @@ int rtn = 0; int aflag = 0; /* do it for all entries */ - while ((ch = getopt(argc, argv, "andfsSi:")) != -1) + while ((ch = getopt(argc, argv, "andfpsSi:")) != -1) switch(ch) { case 'a': aflag = 1; @@ -130,6 +131,9 @@ case 'n': nflag = 1; break; + case 'p': + pflag = 1; + break; case 'S': SETFUNC(F_REPLACE); break; @@ -161,6 +165,10 @@ err(1, "if_nametoindex(%s)", rifname); } } + if (pflag) { + if (func != F_GET && !(func == F_DELETE && aflag)) + errx(1, "-p not applicable to this operation"); + } switch (func) { case F_GET: if (aflag) { @@ -540,6 +548,10 @@ if (rifname && if_indextoname(sdl->sdl_index, ifname) && strcmp(ifname, rifname)) continue; + if (pflag) { + if (rtm->rtm_rmx.rmx_expire == 0) + continue; + } if (addr) { if (addr != sin2->sin_addr.s_addr) continue; @@ -653,10 +665,10 @@ usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", - "usage: arp [-n] [-i interface] hostname", - " arp [-n] [-i interface] -a", + "usage: arp [-np] [-i interface] hostname", + " arp [-np] [-i interface] -a", " arp -d hostname [pub]", - " arp -d [-i interface] -a", + " arp -d [-p] [-i interface] -a", " arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", " arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", " arp -f filename"); Index: arp.8 =================================================================== --- arp.8 (revision 204041) +++ arp.8 (working copy) @@ -36,11 +36,11 @@ .Nd address resolution display and control .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl np .Op Fl i Ar interface .Ar hostname .Nm -.Op Fl n +.Op Fl np .Op Fl i Ar interface .Fl a .Nm @@ -48,6 +48,7 @@ .Op Cm pub .Nm .Fl d +.Op Fl p .Op Fl i Ar interface .Fl a .Nm @@ -111,6 +112,8 @@ Show network addresses as numbers (normally .Nm attempts to display addresses symbolically). +.It Fl p +Hide permanent entries. .It Fl s Ar hostname ether_addr Create an .Tn ARP --- arp.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: