1 .\" $NetBSD: arp.9,v 1.23 2008/04/30 13:10:58 martin Exp $
3 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Ignatios Souvatzis.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
39 .Nd externally visible ARP functions
41 .In netinet/if_inarp.h
43 .Fn arp_ifinit "struct ifnet *ifp" "struct ifaddr *ifa"
45 .Fn arpresolve "struct ifnet *ifp" "struct rtentry *rt" "struct mbuf *m" "struct sockaddr *dst" "u_char *desten"
51 functions provide the interface between the
53 module and the network drivers which need
56 Such drivers must request the
58 attribute in their "files" declaration.
59 .Bl -tag -width "arp_ifinit()"
65 Additionally, it sends out a gratuitous
69 so that other machines are warned that we have a (new) address and
70 duplicate addresses can be detected.
72 You must call this in your drivers' ioctl function when you get a
73 SIOCSIFADDR request with an AF_INET address family.
75 is called by network output functions to resolve an IPv4 address.
78 is given, a new one is looked up or created.
79 If the passed or found
81 does not contain a valid gateway link level address, a pointer to the packet
84 is stored in the route entry, possibly replacing older stored packets, and an
86 request is sent instead.
89 reply is received, the last held packet is send.
90 Otherwise, the looked up address is returned and written into the storage
94 returns 1, if a valid address was stored to
96 and the packet can be sent immediately.
101 packet is received, the network driver (class) input interrupt handler queues
102 the packet on the arpintrq queue, and requests an
104 soft interrupt callback.
106 dequeues the packets, performs sanity checks and calls (for IPv4
108 packets, which are the only ones supported currently) the
112 either generates a reply to request packets, and adds the sender address
113 translation to the routing table, if a matching route entry is found.
114 If the route entry contained a pointer to a held packet, that packet is
119 .\" .Xr fddi_ifattach 9 ,
120 .\" .Xr arc_ifattach 9
122 Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
125 (original implementation)
126 .An Ignatios Souvatzis
127 (support for non-Ethernet)
129 The ARP code is implemented in
130 .Pa sys/net/if_arp.h ,
131 .Pa sys/netinet/if_inarp.h
133 .Pa sys/netinet/if_arp.c .
137 Rewritten to support other than Ethernet link level addresses in