xref: /netbsd-src/share/man/man9/arp.9 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: arp.9,v 1.25 2010/05/14 18:52:53 joerg Exp $
2.\"
3.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Ignatios Souvatzis.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
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.
17.\"
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.
29.\"
30.\"
31.Dd March 3, 1997
32.Dt ARP 9
33.Os
34.Sh NAME
35.Nm arp ,
36.Nm arp_ifinit ,
37.Nm arpresolve ,
38.Nm arpintr
39.Nd externally visible ARP functions
40.Sh SYNOPSIS
41.In netinet/if_inarp.h
42.Ft void
43.Fn arp_ifinit "struct ifnet *ifp" "struct ifaddr *ifa"
44.Ft int
45.Fn arpresolve "struct ifnet *ifp" "struct rtentry *rt" "struct mbuf *m" "struct sockaddr *dst" "u_char *desten"
46.Ft void
47.Fn arpintr
48.Sh DESCRIPTION
49The
50.Nm
51functions provide the interface between the
52.Nm
53module and the network drivers which need
54.Nm
55functionality.
56Such drivers must request the
57.Ar arp
58attribute in their "files" declaration.
59.Bl -tag -width "arp_ifinit()"
60.It Fn arp_ifinit
61Sets up the
62.Nm
63specific fields in
64.Fa ifa .
65Additionally, it sends out a gratuitous
66.Nm
67request on
68.Fa ifp ,
69so that other machines are warned that we have a (new) address and
70duplicate addresses can be detected.
71.Pp
72You must call this in your drivers' ioctl function when you get a
73SIOCSIFADDR request with an AF_INET address family.
74.It Fn arpresolve
75is called by network output functions to resolve an IPv4 address.
76If no
77.Fa rt
78is given, a new one is looked up or created.
79If the passed or found
80.Fa rt
81does not contain a valid gateway link level address, a pointer to the packet
82in
83.Fa m
84is stored in the route entry, possibly replacing older stored packets, and an
85.Nm
86request is sent instead.
87When an
88.Nm
89reply is received, the last held packet is send.
90Otherwise, the looked up address is returned and written into the storage
91.Fa desten
92points to.
93.Fn arpresolve
94returns 1, if a valid address was stored to
95.Fa desten ,
96and the packet can be sent immediately.
97Else a 0 is returned.
98.It Fn arpintr
99When an
100.Nm
101packet is received, the network driver (class) input interrupt handler queues
102the packet on the arpintrq queue, and requests an
103.Fn arpintr
104soft interrupt callback.
105.Fn arpintr
106dequeues the packets, performs sanity checks and calls (for IPv4
107.Nm
108packets, which are the only ones supported currently) the
109.Fn in_arpinput
110function.
111.Fn in_arpinput
112either generates a reply to request packets, and adds the sender address
113translation to the routing table, if a matching route entry is found.
114If the route entry contained a pointer to a held packet, that packet is
115sent.
116.El
117.Sh SEE ALSO
118.Xr ether_ifattach 9
119.\" .Xr fddi_ifattach 9 ,
120.\" .Xr arc_ifattach 9
121.Pp
122Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
123.Sh STANDARDS
124RFC 826
125.Sh HISTORY
126Rewritten to support other than Ethernet link level addresses in
127.Nx 1.3 .
128.Sh AUTHORS
129.An UCB CSRG
130(original implementation)
131.An Ignatios Souvatzis
132(support for non-Ethernet)
133.Sh CODE REFERENCES
134The ARP code is implemented in
135.Pa sys/net/if_arp.h ,
136.Pa sys/netinet/if_inarp.h
137and
138.Pa sys/netinet/if_arp.c .
139