2010-12-02 15:54:13 +03:00
|
|
|
.\" $NetBSD: ethersubr.9,v 1.24 2010/12/02 12:54:13 wiz Exp $
|
1997-05-25 19:54:22 +04:00
|
|
|
.\"
|
1999-02-17 02:34:10 +03:00
|
|
|
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
1997-05-25 19:54:22 +04: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-05-25 19:54:22 +04: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.
|
|
|
|
.\"
|
1999-02-17 01:46:55 +03:00
|
|
|
.\" 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-05-25 19:54:22 +04:00
|
|
|
.\"
|
1997-11-24 09:28:50 +03:00
|
|
|
.Dd March 3, 1997
|
1997-05-25 19:54:22 +04:00
|
|
|
.Dt ETHERSUBR 9
|
1999-03-16 03:40:46 +03:00
|
|
|
.Os
|
1997-05-25 19:54:22 +04:00
|
|
|
.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
|
2003-04-16 17:34:34 +04:00
|
|
|
.In net/if_ether.h
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft void
|
2005-12-26 22:40:14 +03:00
|
|
|
.Fn ether_ifattach "struct ifnet *ifp" "uint8_t *lla"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft int
|
2007-09-19 09:26:21 +04:00
|
|
|
.Fn ether_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft int
|
2007-09-19 09:26:21 +04:00
|
|
|
.Fn ether_delmulti "const struct sockaddr *sa" "struct ethercom *ec"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft void
|
2001-09-04 06:51:15 +04:00
|
|
|
.Fn ETHER_FIRST_MULTI "struct ether_multistep step" "struct ethercom *ec" "struct ether_multi *enm"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft void
|
2001-09-04 06:51:15 +04:00
|
|
|
.Fn ETHER_NEXT_MULTI "struct ether_multistep step" "struct ether_multi *enm"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft int
|
2005-12-26 22:40:14 +03:00
|
|
|
.Fn ETHER_IS_MULTICAST "uint8_t *addr"
|
2003-04-16 17:34:34 +04:00
|
|
|
.In net/if_fddi.h
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft void
|
2005-12-26 22:40:14 +03:00
|
|
|
.Fn fddi_ifattach "struct ifnet *ifp" "uint8_t *lla"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft int
|
2007-09-19 09:26:21 +04:00
|
|
|
.Fn fddi_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Ft int
|
2007-09-19 09:26:21 +04:00
|
|
|
.Fn fddi_delmulti "const struct sockaddr *sa" "struct ethercom *ec"
|
1997-05-25 19:54:22 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2000-11-07 09:43:24 +03:00
|
|
|
.Nm
|
1997-05-25 19:54:22 +04:00
|
|
|
functions provide the interface between the
|
2000-11-07 09:43:24 +03:00
|
|
|
.Nm
|
1999-03-07 01:09:29 +03:00
|
|
|
module and the network drivers which need Ethernet support.
|
|
|
|
Such drivers must request the
|
|
|
|
.Ar ether
|
|
|
|
attribute in their
|
|
|
|
.Ar 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_"
|
1999-03-07 01:09:29 +03:00
|
|
|
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
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn ether_ifattach "ifp" "lla"
|
2001-09-04 06:51:15 +04:00
|
|
|
Perform the device-independent, but Ethernet-specific initialization of
|
|
|
|
the interface pointed to by
|
1997-05-25 19:54:22 +04:00
|
|
|
.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
|
2010-01-25 23:09:15 +03:00
|
|
|
This function must be called from the driver's attach function.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn fddi_ifattach "ifp" "lla"
|
2010-01-25 23:09:15 +03:00
|
|
|
Corresponding function for FDDI devices.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn ether_addmulti "sa" "ec"
|
|
|
|
.It Fn ether_delmulti "sa" "ec"
|
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
|
2007-09-19 09:26:21 +04:00
|
|
|
.Fa sa
|
1997-05-25 19:54:22 +04:00
|
|
|
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
|
1999-03-07 01:09:29 +03:00
|
|
|
requests.
|
2010-01-25 23:09:15 +03:00
|
|
|
If these return
|
1997-11-27 09:17:58 +03:00
|
|
|
.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
|
1999-03-07 01:09:29 +03:00
|
|
|
addresses.
|
|
|
|
In the latter case,
|
1997-11-27 09:17:58 +03:00
|
|
|
.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
|
2010-01-25 23:09:15 +03:00
|
|
|
The
|
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
|
2010-01-25 23:09:15 +03:00
|
|
|
The
|
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.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn fddi_addmulti "sa" "ec"
|
|
|
|
.It Fn fddi_delmulti "sa" "ec"
|
2010-01-25 23:09:15 +03:00
|
|
|
Corresponding functions for FDDI devices.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn ETHER_NEXT_MULTI "step" "enm"
|
2010-01-25 23:09:15 +03:00
|
|
|
A macro to step through all of the
|
|
|
|
.Em ether_multi
|
|
|
|
records, one at a time.
|
2001-09-04 06:51:15 +04:00
|
|
|
The current position is remembered in
|
|
|
|
.Fa step ,
|
|
|
|
which the caller must provide.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn ETHER_FIRST_MULTI "step" "ec" "enm"
|
2010-01-25 23:09:15 +03:00
|
|
|
A macro that must be called to initialize
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fa step
|
2002-10-14 17:43:14 +04:00
|
|
|
and get the first record.
|
|
|
|
Both macros return a
|
2001-09-04 06:51:15 +04:00
|
|
|
.Dv NULL
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fa enm
|
|
|
|
when there are no remaining records.
|
2010-01-25 22:58:46 +03:00
|
|
|
.It Fn ETHER_IS_MULTICAST "addr"
|
2010-01-25 23:09:15 +03:00
|
|
|
A macro that returns 1, if
|
1997-05-25 19:54:22 +04:00
|
|
|
.Fa addr
|
2001-09-04 06:51:15 +04:00
|
|
|
points to an Ethernet/FDDI multicast (or broadcast) address.
|
1997-05-25 19:54:22 +04:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
1998-09-03 12:12:56 +04:00
|
|
|
.Xr arp 9
|
2010-05-14 22:54:01 +04:00
|
|
|
.Sh HISTORY
|
|
|
|
Rewritten to attach to the new ARP system in
|
|
|
|
.Nx 1.3 .
|
1997-05-25 19:54:22 +04:00
|
|
|
.Sh AUTHORS
|
|
|
|
UCB CSRG (original implementation)
|
2009-03-09 20:17:02 +03:00
|
|
|
.Pp
|
1997-05-25 19:54:22 +04:00
|
|
|
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
|
2010-03-22 21:58:31 +03:00
|
|
|
.In net/if_ether.h
|
1997-05-25 19:54:22 +04:00
|
|
|
and defined (if not implemented as macro) in
|
2010-12-02 15:54:13 +03:00
|
|
|
.Pa 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
|
2010-03-22 21:58:31 +03:00
|
|
|
.In net/if_fddi.h
|
1997-11-27 09:17:58 +03:00
|
|
|
and defined (if not implemented as macro) in
|
2010-12-02 15:54:13 +03:00
|
|
|
.Pa sys/net/if_fddisubr.c .
|