1999-03-16 03:40:46 +03:00
|
|
|
.\" $NetBSD: arp.9,v 1.16 1999/03/16 00:40:47 garbled Exp $
|
1997-03-16 22:26:53 +03:00
|
|
|
.\"
|
1999-02-17 02:34:10 +03:00
|
|
|
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
1997-03-16 22:26:53 +03:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
1999-02-17 01:46:55 +03:00
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Ignatios Souvatzis.
|
|
|
|
.\"
|
1997-03-16 22:26:53 +03:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
1999-02-17 01:46:55 +03:00
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
1997-03-16 22:26:53 +03:00
|
|
|
.\"
|
|
|
|
.\"
|
1997-11-24 09:28:50 +03:00
|
|
|
.Dd March 3, 1997
|
1997-03-16 22:26:53 +03:00
|
|
|
.Dt ARP 9
|
1999-03-16 03:40:46 +03:00
|
|
|
.Os
|
1997-03-16 22:26:53 +03:00
|
|
|
.Sh NAME
|
1997-11-12 03:47:32 +03:00
|
|
|
.Nm arp ,
|
|
|
|
.Nm arp_ifinit ,
|
|
|
|
.Nm arpresolve ,
|
|
|
|
.Nm arpintr
|
1997-03-16 22:26:53 +03:00
|
|
|
.Nd externally visible ARP functions
|
|
|
|
.Sh SYNOPSIS
|
1997-03-16 22:43:17 +03:00
|
|
|
.Fd #include <netinet/if_inarp.h>
|
1997-03-16 22:26:53 +03:00
|
|
|
.Ft void
|
|
|
|
.Fn arp_ifinit "struct ifnet *ifp" "struct ifaddr *ifa"
|
1997-03-17 17:06:49 +03:00
|
|
|
.Ft int
|
|
|
|
.Fn arpresolve "struct ifnet *ifp" "struct rtentry *rt" "struct mbuf *m" "struct sockaddr *dst" "u_char *desten"
|
|
|
|
.Ft void
|
|
|
|
.Fn arpintr
|
1997-03-16 22:26:53 +03:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
functions provide the interface between the
|
|
|
|
.Nm
|
|
|
|
module and the network drivers which need
|
|
|
|
.Nm
|
1999-03-07 01:09:29 +03:00
|
|
|
functionality.
|
|
|
|
Such drivers must request the
|
|
|
|
.Ar arp
|
1997-03-17 17:06:49 +03:00
|
|
|
attribute in their "files" declaration.
|
1997-03-16 22:26:53 +03:00
|
|
|
.Bl -tag -width "arp_ifinit()"
|
|
|
|
.It Fn arp_ifinit
|
|
|
|
Sets up the
|
|
|
|
.Nm
|
|
|
|
specific fields in
|
|
|
|
.Fa ifa .
|
1997-03-17 17:06:49 +03:00
|
|
|
Additionally, it sends out a gratitious
|
|
|
|
.Nm
|
|
|
|
request on
|
1997-03-16 22:26:53 +03:00
|
|
|
.Fa ifp ,
|
1997-03-17 17:06:49 +03:00
|
|
|
so that other machines are warned that we have a (new) address and
|
1997-03-16 22:26:53 +03:00
|
|
|
duplicate addresses can be detected.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-05-25 19:55:21 +04:00
|
|
|
You must call this in your drivers' ioctl function when you get a
|
|
|
|
SIOCSIFADDR request with an AF_INET address family.
|
1997-03-17 17:06:49 +03:00
|
|
|
.It Fn arpresolve
|
|
|
|
is called by network output functions to resolve an IPv4 address.
|
|
|
|
If no
|
|
|
|
.Fa rt
|
1999-03-07 01:09:29 +03:00
|
|
|
is given, a new one is looked up or created.
|
|
|
|
If the passed or found
|
1997-03-17 17:06:49 +03:00
|
|
|
.Fa rt
|
|
|
|
does not contain a valid gateway link level address, a pointer to the packet
|
|
|
|
in
|
|
|
|
.Fa m
|
|
|
|
is stored in the route entry, possibly replacing older stored packets, and an
|
|
|
|
.Nm
|
1999-03-07 01:09:29 +03:00
|
|
|
request is sent instead.
|
|
|
|
When an
|
1997-03-17 17:06:49 +03:00
|
|
|
.Nm
|
|
|
|
reply is received, the last held packet is send.
|
|
|
|
Otherwise, the looked up address is returned and written into the storage
|
|
|
|
.Fa desten
|
|
|
|
points to.
|
|
|
|
.Fn arpresolve
|
|
|
|
returns 1, if a valid address was stored to
|
|
|
|
.Fa desten ,
|
1999-03-07 01:09:29 +03:00
|
|
|
and the packet can be sent immediately.
|
|
|
|
Else a 0 is returned.
|
1997-03-17 17:06:49 +03:00
|
|
|
.It Fn arpintr
|
|
|
|
When an
|
|
|
|
.Nm
|
|
|
|
packet is received, the network driver (class) input interupt handler queues
|
|
|
|
the packet on the arpintrq queue, and requests an
|
|
|
|
.Fn arpintr
|
|
|
|
soft interupt callback.
|
|
|
|
.Fn arpintr
|
|
|
|
dequeues the packets, performs sanity checks and calls (for IPv4
|
|
|
|
.Nm
|
|
|
|
packes, which are the only ones supported currently) the
|
|
|
|
.Fn in_arpinput
|
|
|
|
function.
|
|
|
|
.Fn in_arpinput
|
|
|
|
either generates a reply to request packets, and adds the sender address
|
|
|
|
translation to to the routing table, if a matching route entry is found.
|
|
|
|
If the route entry contained a pointer to a held packet, that packet is
|
|
|
|
sent.
|
1997-03-16 22:26:53 +03:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ifattach 9 ,
|
|
|
|
.Xr ether_ifattach 9 ,
|
|
|
|
.Xr fddi_ifattach 9 ,
|
1998-09-03 12:12:56 +04:00
|
|
|
.Xr arc_ifattach 9
|
1997-03-16 22:26:53 +03:00
|
|
|
.br
|
|
|
|
Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
|
|
|
|
.Sh AUTHORS
|
1997-03-16 23:24:08 +03:00
|
|
|
UCB CSRG (original implementation)
|
1997-03-16 22:26:53 +03:00
|
|
|
.br
|
|
|
|
Ignatios Souvatzis (support for non-Ethernet)
|
1997-05-25 21:58:22 +04:00
|
|
|
.Sh CODE REFERENCES
|
1998-09-02 09:13:07 +04:00
|
|
|
The ARP code is implemented in
|
|
|
|
.Pa sys/net/if_arp.h ,
|
|
|
|
.Pa sys/netinet/if_inarp.h
|
|
|
|
and
|
|
|
|
.Pa sys/netinet/if_arp.c .
|
1997-03-16 22:26:53 +03:00
|
|
|
.Sh STANDARDS
|
|
|
|
RFC 826
|
|
|
|
.Sh HISTORY
|
|
|
|
Rewritten to support other than Ethernet link level addresses in
|
1997-11-24 09:28:50 +03:00
|
|
|
.Nx 1.3 .
|