1 .\" $NetBSD: ethersubr.9,v 1.18 2008/04/30 13:10:58 martin Exp $
3 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Ignatios Souvatzis.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
38 .Nm ETHER_FIRST_MULTI ,
39 .Nm ETHER_NEXT_MULTI ,
40 .Nm ETHER_IS_MULTICAST ,
44 .Nd Ethernet and FDDI driver support functions and macros
48 .Fn ether_ifattach "struct ifnet *ifp" "uint8_t *lla"
50 .Fn ether_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
52 .Fn ether_delmulti "const struct sockaddr *sa" "struct ethercom *ec"
54 .Fn ETHER_FIRST_MULTI "struct ether_multistep step" "struct ethercom *ec" "struct ether_multi *enm"
56 .Fn ETHER_NEXT_MULTI "struct ether_multistep step" "struct ether_multi *enm"
58 .Fn ETHER_IS_MULTICAST "uint8_t *addr"
61 .Fn fddi_ifattach "struct ifnet *ifp" "uint8_t *lla"
63 .Fn fddi_addmulti "const struct sockaddr *sa" "struct ethercom *ec"
65 .Fn fddi_delmulti "const struct sockaddr *sa" "struct ethercom *ec"
69 functions provide the interface between the
71 module and the network drivers which need Ethernet support.
72 Such drivers must request the
76 declaration and call the appropriate functions as specified below.
78 FDDI drivers must request the "fddi" attribute in their "files"
79 declaration and call the functions tagged with "fddi_" or "FDDI_"
80 instead, where different.
81 Some macros are shared.
83 Note that you also need the
85 stuff to support IPv4 on your hardware.
86 .Bl -tag -width compact
88 Perform the device-independent, but Ethernet-specific initialization of
89 the interface pointed to by
92 Among other duties, this function creates a record for the link level
93 address in the interface's address list and records the link level address
98 You must call this function from the driver's attach function.
100 corresponding function for FDDI devices.
101 .It Fn ether_addmulti
102 .It Fn ether_delmulti
104 .Pq Fn ether_addmulti
106 .Pq Fn ether_delmulti
107 the address described by the
109 pointer to the Ethernet multicast list belonging to
112 These functions must be called from the driver's ioctl function to
120 the hardware multicast filter must be reinitialized.
122 These functions accept
124 addresses, which are interpreted as Ethernet addresses, or
129 is mapped to a range describing all the Ethernet address
130 space reserved for IPv4 multicast addresses.
135 if an unsupported address family is specified,
137 if a non-multicast address is specified, or
140 the multicast list really changed and the driver should synchronize
141 its hardware filter with it.
144 returns, in addition to the above errors,
146 if the specified address
147 can't be found in the list of multicast addresses.
150 corresponding functions for FDDI devices.
151 .It Fn ETHER_NEXT_MULTI
152 is a macro to step through all of the ether_multi records, one at a time.
153 The current position is remembered in
155 which the caller must provide.
156 .It Fn ETHER_FIRST_MULTI
157 must be called to initialize
159 and get the first record.
163 when there are no remaining records.
164 .It Fn ETHER_IS_MULTICAST
167 points to an Ethernet/FDDI multicast (or broadcast) address.
168 Implemented as a macro.
173 UCB CSRG (original implementation)
175 Ignatios Souvatzis (support for new ARP system)
177 Ethernet support functions are declared in
178 .Aq Pa net/if_ether.h
179 and defined (if not implemented as macro) in
180 .Pa /usr/src/sys/net/if_ethersubr.c .
182 FDDI support functions are declared in
184 and defined (if not implemented as macro) in
185 .Pa /usr/src/sys/net/if_fddisubr.c .
187 Rewritten to attach to the new ARP system in