Home | History | Annotate | Download | only in arp
History log of /src/usr.sbin/arp/arp.c
RevisionDateAuthorComments
 1.68  15-Sep-2020  roy arp: Permanence is from the llentry, not the route
 1.67  15-Sep-2020  roy arp: Show U for Unreachable
 1.66  11-Sep-2020  roy arp: Use SIOCGNBRINFO to display neighbor state information
 1.65  28-Feb-2019  nonaka arp(8): one more to close socket.
 1.64  27-Feb-2019  dholland Teach arp that it's okay to close sockets after using them.
(this requires adding a close op to the rump turds)

Fixes PR 53974 reporting too many open files.
 1.63  31-Jul-2018  nonaka arp(8): Fix the host output when arp -dav.
 1.62  11-Jul-2018  ozaki-r arp: warn if failed to delete a specified arp entry

This restores the original behavior of arp in NetBSD 7.
 1.61  07-Jul-2018  christos Fix the logic for the non auto case
 1.60  06-Jul-2018  christos Add an "auto" keyword to auto-determine the link address from the inet addr.
 1.59  08-Jun-2018  nonaka branches: 1.59.2;
fix usage of `arp -d'.
 1.58  28-Jun-2017  ozaki-r branches: 1.58.4;
Enable to remove multiple ARP/NDP entries for one destination

The kernel can have multiple ARP/NDP entries which have an indentical
destination on different interfaces. This is normal and can be
reproduce easily by ping -I or ping6 -S. We should be able to remove
such entries.

arp -d <ip> and ndp -d <ip> are changed to fetch all ARP/NDP entries
and remove matched entries. So we can remove multiple entries
described above. This fetch all and selective removal behavior is
the same as arp <ip> and ndp <ip>; they also do fetch all entries
and show only matched entries.

Related to PR 51179
 1.57  26-Jun-2017  ozaki-r Fix usage of routing messages on arp -d and ndp -d

It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
 1.56  06-Jun-2017  ryo whitespace police
 1.55  04-Apr-2016  ozaki-r branches: 1.55.8;
Separate nexthop caches from the routing table

By this change, nexthop caches (IP-MAC address pair) are not stored
in the routing table anymore. Instead nexthop caches are stored in
each network interface; we already have lltable/llentry data structure
for this purpose. This change also obsoletes the concept of cloning/cloned
routes. Cloned routes no longer exist while cloning routes still exist
with renamed to connected routes.

Noticeable changes are:
- Nexthop caches aren't listed in route show/netstat -r
- sysctl(NET_RT_DUMP) doesn't return them
- If RTF_LLDATA is specified, it returns nexthop caches
- Several definitions of routing flags and messages are removed
- RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and RTM_RESOLVE
- RTF_CONNECTED is added
- It has the same value of RTF_CLONING for backward compatibility
- route's -xresolve, -[no]cloned and -llinfo options are removed
- -[no]cloning remains because it seems there are users
- -[no]connected is introduced and recommended
to be used instead of -[no]cloning
- route show/netstat -r drops some flags
- 'L' and 'c' are not seen anymore
- 'C' now indicates a connected route
- Gateway value of a route of an interface address is now not
a L2 address but "link#N" like a connected (cloning) route
- Proxy ARP: "arp -s ... pub" doesn't create a route

You can know details of behavior changes by seeing diffs under tests/.

Proposed on tech-net and tech-kern:
http://mail-index.netbsd.org/tech-net/2016/03/11/msg005701.html
 1.54  24-Feb-2016  ozaki-r Kill confusable use of SIN_PROXY
 1.53  31-Jul-2015  ozaki-r Reduce abuse of global variables
 1.52  29-Jul-2015  ozaki-r Introduce rump.arp

arp(8) uses RTM that requires that getpid(2) works correctly. Unfortunately
supporting getpid(2) in librumphijack will be tricky so that we rump-ify
arp(8) as well as ifconfig and route commands.

Suggested by pooka@.
 1.51  07-Jun-2013  christos allow ifscope with pub and proxy
 1.50  07-Jun-2013  christos Add an ifscope <interface> argument to arp in the spirit of the MacOS/X one,
that sets the arp entry on the interface specified. Undocumented for now,
until people decide it is useful.
 1.49  10-Jun-2010  dholland branches: 1.49.6; 1.49.12;
Allow -f -, as per PR 10898.
 1.48  02-Apr-2009  christos Centralize the ROUNDUP and ADVANCE macro in a header file, give them an
RT_ prefix and use them appropriately, instead of making copies. Make
pppd use the RT_ROUNDUP macro; fixes proxyarp setting on 64 bit hosts.

XXX: All this should be pulled up to 5.0
 1.47  21-Jul-2008  lukem branches: 1.47.4; 1.47.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.46  10-Jan-2008  seanb branches: 1.46.6;
- re-enable 'pro' keyword to allow creation / deletion
of 'proxy only' entries (SIN_PROXY flag set).
 1.45  15-Dec-2007  perry convert __attribute__s to applicable cdefs.h macros
 1.44  22-Oct-2006  christos branches: 1.44.8;
WARNS=4.
- pass lint
- don't use sscanf fgets and fixed length buffers
- always use warnx to report errors.
 1.43  23-Sep-2006  dyoung Extract common code from set() and delete() into subroutine
is_llinfo().
 1.42  31-Jan-2006  christos PR/32681: Yves-Emmanuel JUTARD: Fix and document -d [hostname [pub]]
 1.41  16-Mar-2005  xtraeme Kill __P(), use ANSI function declarations, constify; WARNS=3
 1.40  14-Aug-2004  jrf Add -v option to usage message.
 1.39  14-Aug-2003  itojun plug memory leak. PR misc/22479
 1.38  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22366, verified by myself.
 1.37  17-May-2003  itojun ensure string termination
 1.36  17-May-2003  itojun prevent sscanf overrun
 1.35  08-Nov-2002  rafal Convert to use getifaddrs(3) to get interface names; this is mostly removal
of grotty code to unpack data structures returned by the SIOCGIFCONF ioctl.
 1.34  02-Mar-2002  tv branches: 1.34.2;
When converting to use getprogname(), please don't forget the necessary
companion call to setprogname() for portability.
 1.33  28-Feb-2002  pooka re-convert to use getprogname(). This was already once done in rev 1.28,
but silently killed in rev 1.29.

from John Franklin <franklin@elfie.org> in bin/15771
 1.32  06-Oct-2001  bjh21 Use getnameinfo() to format link-layer addresses, rather than doing it
ourselves.
 1.31  29-Jul-2001  chs remove spurious newline in an error message.
 1.30  24-Apr-2001  atatat Provide an easy way for someone to erase all arp entries as opposed
to the common practice of inventing an unwieldy shell construct each
time.

Note: -f (ala route -f) is in use already, and FreeBSD provides "prior
art" for the use of -d and -a together to accomplish this.
 1.29  19-Mar-2001  fair modified patch from PR 8566 to print the interface name for each ARP table
entry, in addition to the MAC address to IP address mapping. Tested on
NetBSD/alpha 1.4.3 and NetBSD/sparc 1.5.1_ALPHA
 1.28  19-Feb-2001  cgd convert to use getprogname()
 1.27  05-Jan-2001  christos Get rid of the TRY_AGAIN kludge. It is completely counter intuitive to have
every DNS lookup fail after the first TRY_AGAIN failure.
Also take care of minor lint stuff [extra h_errno declaratation/NULL vs. 0 etc]
 1.26  11-Oct-2000  is More format string cleanups by sommerfeld.
 1.25  28-Sep-2000  erh Use ROUNDUP to pass addresses to the kernel aligned on a long boundary. Use the sa_len field of each address instead of sizeof(). Makes arp work on 64bit architectures.
 1.24  12-Jul-2000  mason Removed redundant / extra prototypes.
 1.23  10-Feb-1998  mrg branches: 1.23.2; 1.23.10;
add a verbose (-v) flag for when adding/deleting arp entries.
 1.22  18-Nov-1997  fvdl If the arp cache is empty, don't even attempt to retrieve it. Fixes
'bad address' message when the cache is empty.
 1.21  16-Nov-1997  is Make deleting proxy arp entries on ARCnet interfaces work again.
Fixes my own last PR, whose number I don't know yet.
 1.20  18-Oct-1997  lukem branches: 1.20.2;
use __progname
 1.19  16-Oct-1997  lukem WARNSify
 1.18  26-Mar-1997  thorpej Print Ethernet and FDDI addresses in the same format as ether_ntoa().
From Matt Thomas <matt@3am-software.com>
 1.17  15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.16  07-Mar-1997  mikel merge lite2 changes
 1.15  07-Feb-1997  mikel branches: 1.15.2;
fix PR misc/3184, but somewhat differently.
include <unistd.h> for getopt() prototype, reorder includes.
eliminate some leftover unused variables.
 1.14  18-Jan-1997  mikel use ether_aton() from libc; from Klaus Klein <kleink@layla.inka.de>,
with some modifications by myself.
 1.13  08-Dec-1996  mycroft Use warnx() and hstrerror(), rather than herror().
 1.12  24-Apr-1995  cgd needs string.h
 1.11  01-Mar-1995  chopps oops forgot rcsid string, fix that to..
 1.10  01-Mar-1995  chopps fix id's
 1.9  28-Feb-1995  chopps ditch use of inet_addr() use inet_aton() instead.
 1.8  27-Feb-1995  chopps Some KNF clenup.
 1.7  26-Feb-1995  chopps fix typo.
 1.6  25-Feb-1995  chopps enable -f form.
 1.5  13-May-1994  mycroft Clean up import.
 1.4  25-Dec-1993  deraadt patch security hole talked about on comp.security.misc
 1.3  01-Aug-1993  mycroft Add RCS identifiers.
 1.2  18-Apr-1993  mycroft Cleanup for GCC 2.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  07-Mar-1997  mikel import 4.4BSD-Lite2 version
 1.1.1.2  13-May-1994  mycroft From 4.4-Lite.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.15.2.3  10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.15.2.2  19-Feb-1997  is Make this printout and accept arbitrary long link-level addresses.
XXX This should have a sanity check on the length for setting ARP entries.
 1.15.2.1  07-Feb-1997  is file arp.c was added on branch is-newarp on 1997-02-19 18:19:17 +0000
 1.20.2.2  19-Nov-1997  mellon Pull rev 1.22 up from trunk (fvdl)
 1.20.2.1  18-Nov-1997  mellon Pull rev 1.21 up from trunk (is)
 1.23.10.2  01-May-2001  he Pull up revision 1.30 (via patch, requested by atatat):
Make it possible to erase all arp entries in one invocation.
 1.23.10.1  17-Oct-2000  tv Pullup usr.sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.23.2.2  01-Apr-2001  he Pull up revision 1.29 (via patch, requested by fair):
Add interface names to ``arp -a'' output.
 1.23.2.1  19-Oct-2000  he Pull up revision 1.26 (requested by he):
Format string cleanup.
 1.34.2.1  29-Mar-2004  jmc Pullup rev 1.39 (requested by fair in ticket #1636)

Plug memory leak. PR#22479
 1.44.8.2  23-Mar-2008  matt sync with HEAD
 1.44.8.1  09-Jan-2008  matt sync with HEAD
 1.46.6.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.47.6.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.47.4.1  03-Apr-2009  snj Pull up following revision(s) (requested by christos in ticket #650):
sys/net/route.c: revision 1.117
sys/net/route.h: revision 1.73
sys/net/rtsock.c: revision 1.125
usr.sbin/arp/arp.c: revision 1.48
usr.sbin/pppd/pppd/sys-bsd.c: revision 1.59
Centralize the ROUNDUP and ADVANCE macro in a header file, give them an
RT_ prefix and use them appropriately, instead of making copies. Make
pppd use the RT_ROUNDUP macro; fixes proxyarp setting on 64 bit hosts.
 1.49.12.1  23-Jun-2013  tls resync from head
 1.49.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.8.5  03-Mar-2019  martin Pull up following revision(s) (requested by dholland in ticket #1198):

usr.sbin/arp/arp_rumpops.c: revision 1.2
usr.sbin/arp/arp_hostops.c: revision 1.2
usr.sbin/arp/arp.c: revision 1.64
usr.sbin/arp/arp.c: revision 1.65
usr.sbin/arp/prog_ops.h: revision 1.2

Teach arp that it's okay to close sockets after using them.
(this requires adding a close op to the rump turds)

Fixes PR 53974 reporting too many open files.

-

arp(8): one more to close socket.
 1.55.8.4  31-Jul-2018  martin Pull up following revision(s) (requested by nonaka in ticket #957):

usr.sbin/arp/arp.c: revision 1.63

arp(8): Fix the host output when arp -dav.
 1.55.8.3  27-Jul-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #925):

usr.sbin/arp/arp.c: revision 1.62

arp: warn if failed to delete a specified arp entry
This restores the original behavior of arp in NetBSD 7.
 1.55.8.2  11-Jun-2018  martin Pull up following revision(s) (requested by nonaka in ticket #875):

usr.sbin/arp/arp.c: revision 1.59

fix usage of `arp -d'.
 1.55.8.1  07-Jul-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #107):
usr.sbin/arp/arp.c: revision 1.56
sys/net/rtsock.c: revision 1.218
sys/net/if_llatbl.c: revision 1.20
usr.sbin/arp/arp.c: revision 1.57
sys/net/rtsock.c: revision 1.219
sys/net/if_llatbl.c: revision 1.21
usr.sbin/arp/arp.c: revision 1.58
tests/net/net_common.sh: revision 1.19
sys/netinet6/nd6.h: revision 1.84
sys/netinet6/nd6.h: revision 1.85
tests/net/arp/t_arp.sh: revision 1.23
sys/netinet6/in6.c: revision 1.246
tests/net/arp/t_arp.sh: revision 1.24
sys/netinet6/in6.c: revision 1.247
tests/net/arp/t_arp.sh: revision 1.25
sys/netinet6/in6.c: revision 1.248
tests/net/arp/t_arp.sh: revision 1.26
usr.sbin/ndp/ndp.c: revision 1.49
tests/net/arp/t_arp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.20
tests/net/arp/t_arp.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.21
tests/net/arp/t_arp.sh: revision 1.29
tests/net/ndp/t_ndp.sh: revision 1.22
tests/net/ndp/t_ndp.sh: revision 1.23
tests/net/route/t_flags6.sh: revision 1.13
tests/net/ndp/t_ndp.sh: revision 1.24
tests/net/route/t_flags6.sh: revision 1.14
tests/net/ndp/t_ndp.sh: revision 1.25
tests/net/route/t_flags6.sh: revision 1.15
tests/net/ndp/t_ndp.sh: revision 1.26
sbin/route/rtutil.c: revision 1.9
tests/net/ndp/t_ndp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.28
tests/net/net/t_ipv6address.sh: revision 1.14
tests/net/ndp/t_ra.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.29
sys/net/route.h: revision 1.113
tests/net/ndp/t_ra.sh: revision 1.29
sys/net/rtsock.c: revision 1.220
sys/net/rtsock.c: revision 1.221
sys/net/rtsock.c: revision 1.222
sys/net/rtsock.c: revision 1.223
tests/net/route/t_route.sh: revision 1.13
sys/net/rtsock.c: revision 1.224
sys/net/route.c: revision 1.196
sys/net/if_llatbl.c: revision 1.19
sys/net/route.c: revision 1.197
sbin/route/route.c: revision 1.156
tests/net/route/t_flags.sh: revision 1.16
tests/net/route/t_flags.sh: revision 1.17
usr.sbin/ndp/ndp.c: revision 1.50
tests/net/route/t_flags.sh: revision 1.18
sys/netinet/in.c: revision 1.204
tests/net/route/t_flags.sh: revision 1.19
sys/netinet/in.c: revision 1.205
tests/net/arp/t_arp.sh: revision 1.30
tests/net/arp/t_arp.sh: revision 1.31
sys/net/if_llatbl.h: revision 1.11
tests/net/arp/t_arp.sh: revision 1.32
sys/net/if_llatbl.h: revision 1.12
tests/net/arp/t_arp.sh: revision 1.33
sys/netinet6/nd6.c: revision 1.233
sys/netinet6/nd6.c: revision 1.234
sys/netinet/if_arp.c: revision 1.251
sys/netinet6/nd6.c: revision 1.235
sys/netinet/if_arp.c: revision 1.252
sbin/route/route.8: revision 1.57
sys/net/rtsock.c: revision 1.214
sys/net/rtsock.c: revision 1.215
sys/net/rtsock.c: revision 1.216
sys/net/rtsock.c: revision 1.217
whitespace police
Simplify
We can assume that rt_ifp is always non-NULL.
Sending a routing message (RTM_ADD) on adding an llentry
A message used to be sent on adding a cloned route. Restore the
behavior for backward compatibility.
Requested by ryo@
Drop RTF_CONNECTED from a result of RTM_GET for ARP/NDP entries
ARP/NDP entries aren't connected routes.
Reported by ryo@
Support -c <count> option for route monitor
route command exits if it receives <count> routing messages where
<count> is a value specified by -c.
The option is useful to get only particular message(s) in a test script.
Test routing messages emitted on operations of ARP/NDP entries
Do netstat -a for an appropriate protocol
Add missing declarations for cleanup
Set net.inet.arp.keep only if it's required
Don't create a permanent L2 cache entry on adding an address to an interface
It was created to copy FreeBSD, however actually the cache isn't
necessary. Remove it to simplify the code and reduce the cost to
maintain it (e.g., keep a consistency with a corresponding local
route).
Fix typo
Fix in_lltable_match_prefix
The function has not been used but will be used soon.
Remove unused function (nd6_rem_ifa_lle)
Allow in6_lltable_free_entry to be called without holding the afdata lock of ifp as well as in_lltable_free_entry
This behavior is a bit odd and should be fixed in the future...
Purge ARP/NDP entries on an interface when the interface is down
Fix PR kern/51179
Purge all related L2 caches on removing a route
The change addresses situations similar to PR 51179.
Purge L2 caches on changing an interface of a route
The change addresses situations similar to PR 51179.
Test implicit removals of ARP/NDP entries
One test case reproudces PR 51179.
Fix build of kernels without both INET and INET6
Tweak lltable_sysctl_dumparp
- Rename lltable_sysctl_dumparp to lltable_sysctl_dump
because it's not only for ARP
- Enable it not only for INET but also for INET6
Fix usage of routing messages on arp -d and ndp -d
It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
Improve backward compatibility of (fake) routing messages on adding an ARP/NDP entry
A message originally included only DST and GATEWAY. Restore it.
Fix ifdef; care about a case w/ INET6 and w/o INET
Drop RTF_UP from a routing message of a deleted ARP/NDP entry
Check existence of ARP/NDP entries
Checking ARP/NDP entries is valid rather than checking routes.
Fix wrong comment
Drop RTF_LLINFO flag (now it's RTF_LLDATA) from local routes
They don't have llinfo anymore. And also the change fixes unexpected
behavior of ARP proxy.
Restore ARP/NDP entries to route show and netstat -r
Requested by dyoung@ some time ago
Enable to remove multiple ARP/NDP entries for one destination
The kernel can have multiple ARP/NDP entries which have an indentical
destination on different interfaces. This is normal and can be
reproduce easily by ping -I or ping6 -S. We should be able to remove
such entries.
arp -d <ip> and ndp -d <ip> are changed to fetch all ARP/NDP entries
and remove matched entries. So we can remove multiple entries
described above. This fetch all and selective removal behavior is
the same as arp <ip> and ndp <ip>; they also do fetch all entries
and show only matched entries.
Related to PR 51179
Check if ARP/NDP entries are purged when a related route is deleted
 1.58.4.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.58.4.2  28-Jul-2018  pgoyette Sync with HEAD
 1.58.4.1  25-Jun-2018  pgoyette Sync with HEAD
 1.59.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed