xref: /netbsd-src/share/man/man9/arp.9 (revision dc306354b0b29af51801a7632f1e95265a68cd81)
1.\"	$NetBSD: arp.9,v 1.12 1998/09/03 08:12:56 msaitoh Exp $
2.\"
3.\" Copyright (c) 1997 Ignatios Souvatzis.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed for the NetBSD Project
17.\"	by Ignatios Souvatzis
18.\" 4. The name of the author may not be used to endorse or promote products
19.\"    derived from this software without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.Dd March 3, 1997
34.Dt ARP 9
35.Os NetBSD
36.Sh NAME
37.Nm arp ,
38.Nm arp_ifinit ,
39.Nm arpresolve ,
40.Nm arpintr
41.Nd externally visible ARP functions
42.Sh SYNOPSIS
43.Fd #include <netinet/if_inarp.h>
44.Ft void
45.Fn arp_ifinit "struct ifnet *ifp" "struct ifaddr *ifa"
46.Ft int
47.Fn arpresolve "struct ifnet *ifp" "struct rtentry *rt" "struct mbuf *m" "struct sockaddr *dst" "u_char *desten"
48.Ft void
49.Fn arpintr
50.Sh DESCRIPTION
51The
52.Nm
53functions provide the interface between the
54.Nm
55module and the network drivers which need
56.Nm
57functionality. Such drivers must request the
58arp
59attribute in their "files" declaration.
60.Bl -tag -width "arp_ifinit()"
61.It Fn arp_ifinit
62Sets up the
63.Nm
64specific fields in
65.Fa ifa .
66Additionally, it sends out a gratitious
67.Nm
68request on
69.Fa ifp ,
70so that other machines are warned that we have a (new) address and
71duplicate addresses can be detected.
72.Pp
73You must call this in your drivers' ioctl function when you get a
74SIOCSIFADDR request with an AF_INET address family.
75.It Fn arpresolve
76is called by network output functions to resolve an IPv4 address.
77If no
78.Fa rt
79is given, a new one is looked up or created. If 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. When an
87.Nm
88reply is received, the last held packet is send.
89Otherwise, the looked up address is returned and written into the storage
90.Fa desten
91points to.
92.Fn arpresolve
93returns 1, if a valid address was stored to
94.Fa desten ,
95and the packet can be sent immediately. Else a 0 is returned.
96.It Fn arpintr
97When an
98.Nm
99packet is received, the network driver (class) input interupt handler queues
100the packet on the arpintrq queue, and requests an
101.Fn arpintr
102soft interupt callback.
103.Fn arpintr
104dequeues the packets, performs sanity checks and calls (for IPv4
105.Nm
106packes, which are the only ones supported currently) the
107.Fn in_arpinput
108function.
109.Fn in_arpinput
110either generates a reply to request packets, and adds the sender address
111translation to to the routing table, if a matching route entry is found.
112If the route entry contained a pointer to a held packet, that packet is
113sent.
114.El
115.Sh SEE ALSO
116.Xr ifattach 9 ,
117.Xr ether_ifattach 9 ,
118.Xr fddi_ifattach 9 ,
119.Xr arc_ifattach 9
120.br
121Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
122.Sh AUTHORS
123UCB CSRG (original implementation)
124.br
125Ignatios Souvatzis (support for non-Ethernet)
126.Sh CODE REFERENCES
127The ARP code is implemented in
128.Pa sys/net/if_arp.h ,
129.Pa sys/netinet/if_inarp.h
130and
131.Pa sys/netinet/if_arp.c .
132.Sh STANDARDS
133RFC 826
134.Sh HISTORY
135Rewritten to support other than Ethernet link level addresses in
136.Nx 1.3 .
137