1.\" $NetBSD: arp.9,v 1.6 1997/03/17 14:06:50 is 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 34.Dd Mar 3, 1997 35.Dt ARP 9 36.Os NetBSD 37.Sh NAME 38.Nm ARP 39.Nd externally visible ARP functions 40.Sh SYNOPSIS 41.Fd #include <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. Such drivers must request the 56arp 57attribute in their "files" declaration. 58 59 60.Bl -tag -width "arp_ifinit()" 61 62.It Fn arp_ifinit 63Sets up the 64.Nm 65specific fields in 66.Fa ifa . 67Additionally, it sends out a gratitious 68.Nm 69request on 70.Fa ifp , 71so that other machines are warned that we have a (new) address and 72duplicate addresses can be detected. 73 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. If the passed or found 79.Fa rt 80does not contain a valid gateway link level address, a pointer to the packet 81in 82.Fa m 83is stored in the route entry, possibly replacing older stored packets, and an 84.Nm 85request is sent instead. When an 86.Nm 87reply is received, the last held packet is send. 88Otherwise, the looked up address is returned and written into the storage 89.Fa desten 90points to. 91.Fn arpresolve 92returns 1, if a valid address was stored to 93.Fa desten , 94and the packet can be sent immediately. Else a 0 is returned. 95 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 115.El 116 117 118.\" .Sh ERRORS 119 120.Sh SEE ALSO 121.Xr ifattach 9 , 122.Xr ether_ifattach 9 , 123.Xr fddi_ifattach 9 , 124.Xr arc_ifattach 9 . 125 126.br 127Plummer, D., "RFC826", An Ethernet Address Resolution Protocol. 128 129.Sh AUTHORS 130UCB CSRG (original implementation) 131.br 132Ignatios Souvatzis (support for non-Ethernet) 133 134.\" .Sh BUGS 135 136.Sh STANDARDS 137 138RFC 826 139 140.Sh HISTORY 141Rewritten to support other than Ethernet link level addresses in 142.Nx 1.2d . 143