[BACK]Return to ethersubr.9 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man9

File: [cvs.NetBSD.org] / src / share / man / man9 / ethersubr.9 (download)

Revision 1.24, Thu Dec 2 12:54:13 2010 UTC (13 years, 4 months ago) by wiz
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, uebayasi-xip-base7, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys
Changes since 1.23: +3 -3 lines

Remove boilerplate in CODE REFERENCES on file paths.
Describe in intro(9) how to read paths in the CODE REFERENCES section.

.\"	$NetBSD: ethersubr.9,v 1.24 2010/12/02 12:54:13 wiz Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Ignatios Souvatzis.
.\"
.\" 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.
.\"
.\" 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.
.\"
.Dd March 3, 1997
.Dt ETHERSUBR 9
.Os
.Sh NAME
.Nm ethersubr ,
.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
.Nd Ethernet and FDDI driver support functions and macros
.Sh SYNOPSIS
.In net/if_ether.h
.Ft void
.Fn ether_ifattach "struct ifnet *ifp" "uint8_t *lla"
.Ft int
.Fn ether_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
.Ft int
.Fn ether_delmulti "const struct sockaddr *sa" "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 "uint8_t *addr"
.In net/if_fddi.h
.Ft void
.Fn fddi_ifattach "struct ifnet *ifp" "uint8_t *lla"
.Ft int
.Fn fddi_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
.Ft int
.Fn fddi_delmulti "const struct sockaddr *sa" "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
.Ar ether
attribute in their
.Ar files
declaration and call the appropriate functions as specified below.
.Pp
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.
.Pp
Note that you also need the
.Xr arp 9
stuff to support IPv4 on your hardware.
.Bl -tag -width compact
.It Fn ether_ifattach "ifp" "lla"
Perform the device-independent, but Ethernet-specific initialization of
the interface pointed to by
.Fa ifp .
.Pp
Among other duties, this function creates a record for the link level
address in the interface's address list and records the link level address
pointed to by
.Fa lla
there.
.Pp
This function must be called from the driver's attach function.
.It Fn fddi_ifattach "ifp" "lla"
Corresponding function for FDDI devices.
.It Fn ether_addmulti "sa" "ec"
.It Fn ether_delmulti "sa" "ec"
Add
.Pq Fn ether_addmulti
or delete
.Pq Fn ether_delmulti
the address described by the
.Fa sa
pointer to the Ethernet multicast list belonging to
.Fa ec .
.Pp
These functions must be called from the driver's ioctl function to
handle
.Dv SIOCADDMULTI
and
.Dv SIOCDELMULTI
requests.
If these return
.Er ENETRESET ,
the hardware multicast filter must be reinitialized.
.Pp
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
space reserved for IPv4 multicast addresses.
.Pp
The
.Fn ether_addmulti
returns
.Er EAFNOSUPPORT
if an unsupported address family is specified,
.Er EINVAL
if a non-multicast address is specified, or
.Er ENETRESET
if
the multicast list really changed and the driver should synchronize
its hardware filter with it.
.Pp
The
.Fn ether_delmulti
returns, in addition to the above errors,
.Er ENXIO
if the specified address
can't be found in the list of multicast addresses.
.It Fn fddi_addmulti "sa" "ec"
.It Fn fddi_delmulti "sa" "ec"
Corresponding functions for FDDI devices.
.It Fn ETHER_NEXT_MULTI "step" "enm"
A macro to step through all of the
.Em 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 "step" "ec" "enm"
A macro that must be called to initialize
.Fa step
and get the first record.
Both macros return a
.Dv NULL
.Fa enm
when there are no remaining records.
.It Fn ETHER_IS_MULTICAST "addr"
A macro that returns 1, if
.Fa addr
points to an Ethernet/FDDI multicast (or broadcast) address.
.El
.Sh SEE ALSO
.Xr arp 9
.Sh HISTORY
Rewritten to attach to the new ARP system in
.Nx 1.3 .
.Sh AUTHORS
UCB CSRG (original implementation)
.Pp
Ignatios Souvatzis (support for new ARP system)
.Sh CODE REFERENCES
Ethernet support functions are declared in
.In net/if_ether.h
and defined (if not implemented as macro) in
.Pa sys/net/if_ethersubr.c .
.Pp
FDDI support functions are declared in
.In net/if_fddi.h
and defined (if not implemented as macro) in
.Pa sys/net/if_fddisubr.c .