1.\" $NetBSD: arp.9,v 1.8 1997/05/25 17:58:22 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 74You must call this in your drivers' ioctl function when you get a 75SIOCSIFADDR request with an AF_INET address family. 76 77.It Fn arpresolve 78is called by network output functions to resolve an IPv4 address. 79If no 80.Fa rt 81is given, a new one is looked up or created. If the passed or found 82.Fa rt 83does not contain a valid gateway link level address, a pointer to the packet 84in 85.Fa m 86is stored in the route entry, possibly replacing older stored packets, and an 87.Nm 88request is sent instead. When an 89.Nm 90reply is received, the last held packet is send. 91Otherwise, the looked up address is returned and written into the storage 92.Fa desten 93points to. 94.Fn arpresolve 95returns 1, if a valid address was stored to 96.Fa desten , 97and the packet can be sent immediately. Else a 0 is returned. 98 99.It Fn arpintr 100When an 101.Nm 102packet is received, the network driver (class) input interupt handler queues 103the packet on the arpintrq queue, and requests an 104.Fn arpintr 105soft interupt callback. 106.Fn arpintr 107dequeues the packets, performs sanity checks and calls (for IPv4 108.Nm 109packes, which are the only ones supported currently) the 110.Fn in_arpinput 111function. 112.Fn in_arpinput 113either generates a reply to request packets, and adds the sender address 114translation to to the routing table, if a matching route entry is found. 115If the route entry contained a pointer to a held packet, that packet is 116sent. 117 118.El 119 120 121.\" .Sh ERRORS 122 123.Sh SEE ALSO 124.Xr ifattach 9 , 125.Xr ether_ifattach 9 , 126.Xr fddi_ifattach 9 , 127.Xr arc_ifattach 9 . 128 129.br 130Plummer, D., "RFC826", An Ethernet Address Resolution Protocol. 131 132.Sh AUTHORS 133UCB CSRG (original implementation) 134.br 135Ignatios Souvatzis (support for non-Ethernet) 136 137.Sh CODE REFERENCES 138 139The ARP code is implemented in sys/net/if_arp.h, sys/netinet/if_inarp.h and 140sys/netinet/if_arp.c. 141 142.\" .Sh BUGS 143 144.Sh STANDARDS 145 146RFC 826 147 148.Sh HISTORY 149Rewritten to support other than Ethernet link level addresses in 150.Nx 1.2d . 151