1997-11-27 09:17:58 +03:00
|
|
|
.\" $NetBSD: ethersubr.9,v 1.5 1997/11/27 06:17:59 mikel Exp $
|
1997-05-25 19:54:22 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1997 Ignatios Souvatzis.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" 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:
|
|
|
|
.\" This product includes software developed for the NetBSD Project
|
|
|
|
.\" by Ignatios Souvatzis
|
|
|
|
.\" 4. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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-11-24 09:28:50 +03:00
|
|
|
.Dd March 3, 1997
|
1997-05-25 19:54:22 +04:00
|
|
|
.Dt ETHERSUBR 9
|
|
|
|
.Os NetBSD
|
|
|
|
.Sh NAME
|
1997-11-27 09:17:58 +03:00
|
|
|
.Nm ethersubr ,
|
1997-11-12 03:47:32 +03:00
|
|
|
.Nm ether_ifattach ,
|
|
|
|
.Nm ether_addmulti ,
|
|
|
|
.Nm ether_delmulti ,
|
|
|
|
.Nm ETHER_FIRST_MULTI ,
|
|
|
|
.Nm ETHER_NEXT_MULTI ,
|
|
|
|
.Nm ETHER_IS_MULTICAST ,
|
|
|
|
.Nm fddi_ifattach ,
|
|
|
|
.Nm fddi_addmulti ,
|
|
|
|
.Nm fddi_delmulti
|
1997-05-25 19:54:22 +04:00
|
|
|
.Nd Ethernet and FDDI driver support functions and macros
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <net/if_ether.h>
|
|
|
|
.Ft void
|
|
|
|
.Fn ether_ifattach "struct ifnet *ifp" "u_int8_t *lla"
|
|
|
|
.Ft int
|
|
|
|
.Fn ether_addmulti "struct ifrequest *ifr" "struct ethercom *ec"
|
|
|
|
.Ft int
|
|
|
|
.Fn ether_delmulti "struct ifrequest *ifr" "struct ethercom *ec"
|
|
|
|
.Ft void
|
|
|
|
.Fn ETHER_FIRST_MULTI "struct ether_multistep step" "struct ethercom *ec" "struct ether_multi *enm"
|
|
|
|
.Ft void
|
|
|
|
.Fn ETHER_NEXT_MULTI "struct ether_multistep step" "struct ether_multi *enm"
|
|
|
|
.Ft int
|
|
|
|
.Fn ETHER_IS_MULTICAST "u_int8_t *addr"
|
|
|
|
.Fd #include <net/if_fddi.h>
|
|
|
|
.Ft void
|
|
|
|
.Fn fddi_ifattach "struct ifnet *ifp" "u_int8_t *lla"
|
|
|
|
.Ft int
|
|
|
|
.Fn fddi_addmulti "struct ifrequest *ifr" "struct ethercom *ec"
|
|
|
|
.Ft int
|
|
|
|
.Fn fddi_delmulti "struct ifrequest *ifr" "struct ethercom *ec"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
functions provide the interface between the
|
|
|
|
.Nm
|
|
|
|
module and the network drivers which need Ethernet support. Such
|
|
|
|
drivers must request the "ether" attribute in their "files" declaration
|
|
|
|
and call the appropriate functions as specified below.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-05-25 19:54:22 +04:00
|
|
|
FDDI drivers must request the "fddi" attribute in their "files"
|
|
|
|
declaration and call the functions tagged with "fddi_" or "FDDI_"
|
|
|
|
instead, where different. Some macros are shared.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-11-27 09:17:58 +03:00
|
|
|
Note that you also need the
|
|
|
|
.Xr arp 9
|
1997-05-25 19:54:22 +04:00
|
|
|
stuff to support IPv4 on your hardware.
|
|
|
|
.Bl -tag -width compact
|
|
|
|
.It Fn ether_ifattach
|
1997-11-27 09:17:58 +03:00
|
|
|
Perform the device-independent, but Ethernet-specific initialization of
|
1997-05-25 19:54:22 +04:00
|
|
|
the interface pointed to by
|
|
|
|
.Fa ifp .
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-05-25 19:54:22 +04:00
|
|
|
Among other duties, this function creates a record for the link level
|
1997-11-27 09:17:58 +03:00
|
|
|
address in the interface's address list and records the link level address
|
1997-05-25 19:54:22 +04:00
|
|
|
pointed to by
|
|
|
|
.Fa lla
|
|
|
|
there.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-11-27 09:17:58 +03:00
|
|
|
You must call this function from the driver's attach function.
|
1997-05-25 19:54:22 +04:00
|
|
|
.It Fn fddi_ifattach
|
|
|
|
corresponding function for FDDI devices.
|
|
|
|
.It Fn ether_addmulti
|
|
|
|
.It Fn ether_delmulti
|
1997-11-27 09:17:58 +03:00
|
|
|
Add
|
|
|
|
.Pq Fn ether_addmulti
|
|
|
|
or delete
|
|
|
|
.Pq Fn ether_delmulti
|
1997-05-25 19:54:22 +04:00
|
|
|
the address described by the
|
|
|
|
.Fa ifr
|
|
|
|
pointer to the Ethernet multicast list belonging to
|
|
|
|
.Fa ec .
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-11-27 09:17:58 +03:00
|
|
|
These functions must be called from the driver's ioctl function to
|
|
|
|
handle
|
|
|
|
.Dv SIOCADDMULTI
|
|
|
|
and
|
|
|
|
.Dv SIOCDELMULTI
|
|
|
|
requests. If they return
|
|
|
|
.Er ENETRESET ,
|
|
|
|
the hardware multicast filter must be reinitialized.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-11-27 09:17:58 +03:00
|
|
|
These functions accept
|
|
|
|
.Dv AF_UNSPEC
|
|
|
|
addresses, which are interpreted as Ethernet addresses, or
|
|
|
|
.Dv AF_INET
|
|
|
|
addresses. In the latter case,
|
|
|
|
.Dv INADDR_ANY
|
|
|
|
is mapped to a range describing all the Ethernet address
|
1997-05-25 19:54:22 +04:00
|
|
|
space reserved for IPv4 multicast addresses.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fn ether_addmulti
|
1997-11-27 09:17:58 +03:00
|
|
|
returns
|
|
|
|
.Er EAFNOSUPPORT
|
|
|
|
if an unsupported address family is specified,
|
|
|
|
.Er EINVAL
|
|
|
|
if a non-multicast address is specified, or
|
|
|
|
.Er ENETRESET
|
|
|
|
if
|
1997-05-25 19:54:22 +04:00
|
|
|
the multicast list really changed and the driver should synchronize
|
|
|
|
its hardware filter with it.
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fn ether_delmulti
|
1997-11-27 09:17:58 +03:00
|
|
|
returns, in addition to the above errors,
|
|
|
|
.Er ENXIO
|
|
|
|
if the specified address
|
1997-05-25 19:54:22 +04:00
|
|
|
can't be found in the list of multicast addresses.
|
1997-05-25 21:58:22 +04:00
|
|
|
.It Fn fddi_addmulti
|
|
|
|
.It Fn fddi_delmulti
|
|
|
|
corresponding functions for FDDI devices.
|
1997-05-25 19:54:22 +04:00
|
|
|
.It Fn ETHER_NEXT_MULTI
|
|
|
|
is a macro to step through all of the ether_multi records, one at a time.
|
|
|
|
The current position is remembered in
|
|
|
|
.Fa step ,
|
|
|
|
which the caller must provide.
|
|
|
|
.It Fn ETHER_FIRST_MULTI
|
|
|
|
must be called to initialize
|
|
|
|
.Fa step
|
1997-11-27 09:17:58 +03:00
|
|
|
and get the first record. Both macros return a
|
|
|
|
.Dv NULL
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fa enm
|
|
|
|
when there are no remaining records.
|
|
|
|
.It Fn ETHER_IS_MULTICAST
|
|
|
|
returns 1, if
|
|
|
|
.Fa addr
|
|
|
|
points to an Ethernet/FDDI multicast (or broadcast) address.
|
|
|
|
Implemented as a macro.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr arp 9 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
UCB CSRG (original implementation)
|
|
|
|
.br
|
|
|
|
Ignatios Souvatzis (support for new ARP system)
|
1997-05-25 21:58:22 +04:00
|
|
|
.Sh CODE REFERENCES
|
1997-11-27 09:17:58 +03:00
|
|
|
Ethernet support functions are declared in
|
|
|
|
.Aq Pa net/if_ether.h
|
1997-05-25 19:54:22 +04:00
|
|
|
and defined (if not implemented as macro) in
|
1997-11-27 09:17:58 +03:00
|
|
|
.Pa /usr/src/sys/net/if_ethersubr.c .
|
1997-11-24 09:28:50 +03:00
|
|
|
.Pp
|
1997-11-27 09:17:58 +03:00
|
|
|
FDDI support functions are declared in
|
|
|
|
.Aq Pa net/if_fddi.h
|
|
|
|
and defined (if not implemented as macro) in
|
|
|
|
.Pa /usr/src/sys/net/if_fddisubr.c .
|
1997-05-25 19:54:22 +04:00
|
|
|
.Sh HISTORY
|
|
|
|
Rewritten to attach to the new ARP system in
|
1997-11-24 09:28:50 +03:00
|
|
|
.Nx 1.3 .
|