2005-01-07 01:45:51 +00:00
|
|
|
/*-
|
1997-01-17 23:54:45 +00:00
|
|
|
* Copyright (c) 1995, 1996
|
|
|
|
* Matt Thomas <matt@3am-software.com>. All rights reserved.
|
1995-03-14 09:16:07 +00:00
|
|
|
* Copyright (c) 1982, 1989, 1993
|
|
|
|
* The Regents of the University of California. 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 by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
|
|
|
*
|
1995-03-14 22:15:36 +00:00
|
|
|
* from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1995-03-14 09:16:07 +00:00
|
|
|
*/
|
|
|
|
|
1998-01-08 23:42:31 +00:00
|
|
|
#include "opt_inet.h"
|
1999-12-07 17:39:16 +00:00
|
|
|
#include "opt_inet6.h"
|
1997-12-15 20:31:25 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2002-03-29 09:37:56 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <sys/mbuf.h>
|
2002-03-29 09:37:56 +00:00
|
|
|
#include <sys/module.h>
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <sys/socket.h>
|
2002-03-29 09:37:56 +00:00
|
|
|
#include <sys/sockio.h>
|
1997-01-17 23:54:45 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <net/if.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <net/if_var.h>
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <net/if_dl.h>
|
2003-03-15 16:37:28 +00:00
|
|
|
#include <net/if_llc.h>
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <net/if_types.h>
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
#include <net/if_llatbl.h>
|
2003-03-15 16:37:28 +00:00
|
|
|
|
2008-11-06 09:07:56 +00:00
|
|
|
#include <net/ethernet.h>
|
2002-03-29 09:37:56 +00:00
|
|
|
#include <net/netisr.h>
|
|
|
|
#include <net/route.h>
|
|
|
|
#include <net/bpf.h>
|
2002-03-29 08:51:42 +00:00
|
|
|
#include <net/fddi.h>
|
1995-03-14 09:16:07 +00:00
|
|
|
|
1999-12-07 17:39:16 +00:00
|
|
|
#if defined(INET) || defined(INET6)
|
1995-03-14 09:16:07 +00:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_var.h>
|
|
|
|
#include <netinet/if_ether.h>
|
1998-01-08 23:42:31 +00:00
|
|
|
#endif
|
1999-12-07 17:39:16 +00:00
|
|
|
#ifdef INET6
|
|
|
|
#include <netinet6/nd6.h>
|
|
|
|
#endif
|
1995-03-14 09:16:07 +00:00
|
|
|
|
|
|
|
#ifdef DECNET
|
|
|
|
#include <netdnet/dn.h>
|
|
|
|
#endif
|
|
|
|
|
2006-10-22 11:52:19 +00:00
|
|
|
#include <security/mac/mac_framework.h>
|
|
|
|
|
2004-03-09 23:55:59 +00:00
|
|
|
static const u_char fddibroadcastaddr[FDDI_ADDR_LEN] =
|
2002-03-29 10:40:35 +00:00
|
|
|
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
|
|
|
|
2002-03-29 11:22:22 +00:00
|
|
|
static int fddi_resolvemulti(struct ifnet *, struct sockaddr **,
|
2002-03-24 09:34:04 +00:00
|
|
|
struct sockaddr *);
|
2013-04-26 12:50:32 +00:00
|
|
|
static int fddi_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
|
2009-04-16 20:30:28 +00:00
|
|
|
struct route *);
|
2002-11-15 00:00:15 +00:00
|
|
|
static void fddi_input(struct ifnet *ifp, struct mbuf *m);
|
2002-03-29 11:22:22 +00:00
|
|
|
|
2003-03-15 19:10:19 +00:00
|
|
|
#define senderr(e) do { error = (e); goto bad; } while (0)
|
2002-03-29 08:04:36 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
/*
|
|
|
|
* FDDI output routine.
|
|
|
|
* Encapsulate a packet of type family for the local net.
|
|
|
|
* Use trailer local net encapsulation if enough data in first
|
|
|
|
* packet leaves a multiple of 512 bytes of data in remainder.
|
|
|
|
* Assumes that ifp is actually pointer to arpcom structure.
|
|
|
|
*/
|
2002-03-29 11:22:22 +00:00
|
|
|
static int
|
2013-04-26 12:50:32 +00:00
|
|
|
fddi_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|
|
|
struct route *ro)
|
1995-03-14 09:16:07 +00:00
|
|
|
{
|
1997-01-17 23:54:45 +00:00
|
|
|
u_int16_t type;
|
Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue. Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.
IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue. An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.
Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
|
|
|
int loop_copy = 0, error = 0, hdrcmplt = 0;
|
2002-03-29 08:51:42 +00:00
|
|
|
u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN];
|
2002-03-29 07:12:10 +00:00
|
|
|
struct fddi_header *fh;
|
2009-06-10 09:07:05 +00:00
|
|
|
#if defined(INET) || defined(INET6)
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
struct llentry *lle;
|
2009-06-10 09:07:05 +00:00
|
|
|
#endif
|
1995-03-14 09:16:07 +00:00
|
|
|
|
2002-10-20 22:27:59 +00:00
|
|
|
#ifdef MAC
|
2007-10-24 19:04:04 +00:00
|
|
|
error = mac_ifnet_check_transmit(ifp, m);
|
2002-10-20 22:27:59 +00:00
|
|
|
if (error)
|
|
|
|
senderr(error);
|
|
|
|
#endif
|
|
|
|
|
2003-03-16 00:17:44 +00:00
|
|
|
if (ifp->if_flags & IFF_MONITOR)
|
|
|
|
senderr(ENETDOWN);
|
2005-08-09 10:20:02 +00:00
|
|
|
if (!((ifp->if_flags & IFF_UP) &&
|
|
|
|
(ifp->if_drv_flags & IFF_DRV_RUNNING)))
|
1995-03-14 09:16:07 +00:00
|
|
|
senderr(ENETDOWN);
|
1998-03-30 09:56:58 +00:00
|
|
|
getmicrotime(&ifp->if_lastchange);
|
2003-03-02 21:34:37 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
switch (dst->sa_family) {
|
|
|
|
#ifdef INET
|
1997-01-17 23:54:45 +00:00
|
|
|
case AF_INET: {
|
2009-06-10 09:07:05 +00:00
|
|
|
struct rtentry *rt0 = NULL;
|
|
|
|
|
|
|
|
if (ro != NULL)
|
|
|
|
rt0 = ro->ro_rt;
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
error = arpresolve(ifp, rt0, m, dst, edst, &lle);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
if (error)
|
|
|
|
return (error == EWOULDBLOCK ? 0 : error);
|
1997-01-17 23:54:45 +00:00
|
|
|
type = htons(ETHERTYPE_IP);
|
1995-03-14 09:16:07 +00:00
|
|
|
break;
|
1997-01-17 23:54:45 +00:00
|
|
|
}
|
2004-03-14 05:24:54 +00:00
|
|
|
case AF_ARP:
|
|
|
|
{
|
|
|
|
struct arphdr *ah;
|
|
|
|
ah = mtod(m, struct arphdr *);
|
|
|
|
ah->ar_hrd = htons(ARPHRD_ETHER);
|
|
|
|
|
|
|
|
loop_copy = -1; /* if this is for us, don't do it */
|
|
|
|
|
|
|
|
switch (ntohs(ah->ar_op)) {
|
|
|
|
case ARPOP_REVREQUEST:
|
|
|
|
case ARPOP_REVREPLY:
|
|
|
|
type = htons(ETHERTYPE_REVARP);
|
|
|
|
break;
|
|
|
|
case ARPOP_REQUEST:
|
|
|
|
case ARPOP_REPLY:
|
|
|
|
default:
|
|
|
|
type = htons(ETHERTYPE_ARP);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m->m_flags & M_BCAST)
|
|
|
|
bcopy(ifp->if_broadcastaddr, edst, FDDI_ADDR_LEN);
|
|
|
|
else
|
|
|
|
bcopy(ar_tha(ah), edst, FDDI_ADDR_LEN);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
2003-03-15 15:09:11 +00:00
|
|
|
#endif /* INET */
|
1999-12-07 17:39:16 +00:00
|
|
|
#ifdef INET6
|
|
|
|
case AF_INET6:
|
2008-12-17 10:27:34 +00:00
|
|
|
error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, &lle);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
if (error)
|
|
|
|
return (error); /* Something bad happened */
|
1999-12-07 17:39:16 +00:00
|
|
|
type = htons(ETHERTYPE_IPV6);
|
|
|
|
break;
|
2003-03-15 15:09:11 +00:00
|
|
|
#endif /* INET6 */
|
1999-10-15 05:07:00 +00:00
|
|
|
case pseudo_AF_HDRCMPLT:
|
|
|
|
{
|
2013-04-26 12:50:32 +00:00
|
|
|
const struct ether_header *eh;
|
|
|
|
|
1999-10-15 05:07:00 +00:00
|
|
|
hdrcmplt = 1;
|
2013-04-26 12:50:32 +00:00
|
|
|
eh = (const struct ether_header *)dst->sa_data;
|
|
|
|
bcopy(eh->ether_shost, esrc, FDDI_ADDR_LEN);
|
1999-10-15 05:07:00 +00:00
|
|
|
/* FALLTHROUGH */
|
|
|
|
}
|
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
case AF_UNSPEC:
|
|
|
|
{
|
2013-04-26 12:50:32 +00:00
|
|
|
const struct ether_header *eh;
|
|
|
|
|
1998-06-14 20:58:17 +00:00
|
|
|
loop_copy = -1;
|
2013-04-26 12:50:32 +00:00
|
|
|
eh = (const struct ether_header *)dst->sa_data;
|
|
|
|
bcopy(eh->ether_dhost, edst, FDDI_ADDR_LEN);
|
1995-03-14 09:16:07 +00:00
|
|
|
if (*edst & 1)
|
|
|
|
m->m_flags |= (M_BCAST|M_MCAST);
|
|
|
|
type = eh->ether_type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AF_IMPLINK:
|
|
|
|
{
|
|
|
|
fh = mtod(m, struct fddi_header *);
|
|
|
|
error = EPROTONOSUPPORT;
|
|
|
|
switch (fh->fddi_fc & (FDDIFC_C|FDDIFC_L|FDDIFC_F)) {
|
|
|
|
case FDDIFC_LLC_ASYNC: {
|
|
|
|
/* legal priorities are 0 through 7 */
|
|
|
|
if ((fh->fddi_fc & FDDIFC_Z) > 7)
|
|
|
|
goto bad;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FDDIFC_LLC_SYNC: {
|
|
|
|
/* FDDIFC_Z bits reserved, must be zero */
|
|
|
|
if (fh->fddi_fc & FDDIFC_Z)
|
|
|
|
goto bad;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FDDIFC_SMT: {
|
|
|
|
/* FDDIFC_Z bits must be non zero */
|
|
|
|
if ((fh->fddi_fc & FDDIFC_Z) == 0)
|
|
|
|
goto bad;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
/* anything else is too dangerous */
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
error = 0;
|
|
|
|
if (fh->fddi_dhost[0] & 1)
|
|
|
|
m->m_flags |= (M_BCAST|M_MCAST);
|
|
|
|
goto queue_it;
|
|
|
|
}
|
|
|
|
default:
|
2002-10-21 02:51:56 +00:00
|
|
|
if_printf(ifp, "can't handle af%d\n", dst->sa_family);
|
1995-03-14 09:16:07 +00:00
|
|
|
senderr(EAFNOSUPPORT);
|
|
|
|
}
|
|
|
|
|
2002-03-29 10:23:42 +00:00
|
|
|
/*
|
|
|
|
* Add LLC header.
|
|
|
|
*/
|
1995-03-14 09:16:07 +00:00
|
|
|
if (type != 0) {
|
2002-03-29 07:12:10 +00:00
|
|
|
struct llc *l;
|
2012-12-05 08:04:20 +00:00
|
|
|
M_PREPEND(m, LLC_SNAPFRAMELEN, M_NOWAIT);
|
1995-03-14 09:16:07 +00:00
|
|
|
if (m == 0)
|
|
|
|
senderr(ENOBUFS);
|
|
|
|
l = mtod(m, struct llc *);
|
|
|
|
l->llc_control = LLC_UI;
|
|
|
|
l->llc_dsap = l->llc_ssap = LLC_SNAP_LSAP;
|
2003-03-15 15:09:11 +00:00
|
|
|
l->llc_snap.org_code[0] =
|
|
|
|
l->llc_snap.org_code[1] =
|
|
|
|
l->llc_snap.org_code[2] = 0;
|
|
|
|
l->llc_snap.ether_type = htons(type);
|
1995-03-14 09:16:07 +00:00
|
|
|
}
|
1998-06-12 03:48:19 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
/*
|
|
|
|
* Add local net header. If no space in first mbuf,
|
|
|
|
* allocate another.
|
|
|
|
*/
|
2012-12-05 08:04:20 +00:00
|
|
|
M_PREPEND(m, FDDI_HDR_LEN, M_NOWAIT);
|
1995-03-14 09:16:07 +00:00
|
|
|
if (m == 0)
|
|
|
|
senderr(ENOBUFS);
|
|
|
|
fh = mtod(m, struct fddi_header *);
|
|
|
|
fh->fddi_fc = FDDIFC_LLC_ASYNC|FDDIFC_LLC_PRIO4;
|
2002-03-29 09:37:56 +00:00
|
|
|
bcopy((caddr_t)edst, (caddr_t)fh->fddi_dhost, FDDI_ADDR_LEN);
|
1995-03-14 09:16:07 +00:00
|
|
|
queue_it:
|
1999-10-15 05:07:00 +00:00
|
|
|
if (hdrcmplt)
|
2002-03-29 09:37:56 +00:00
|
|
|
bcopy((caddr_t)esrc, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN);
|
1999-10-15 05:07:00 +00:00
|
|
|
else
|
2005-11-11 16:04:59 +00:00
|
|
|
bcopy(IF_LLADDR(ifp), (caddr_t)fh->fddi_shost,
|
2002-03-29 08:51:42 +00:00
|
|
|
FDDI_ADDR_LEN);
|
2002-03-29 09:52:01 +00:00
|
|
|
|
1998-06-12 03:48:19 +00:00
|
|
|
/*
|
|
|
|
* If a simplex interface, and the packet is being sent to our
|
|
|
|
* Ethernet address or a broadcast address, loopback a copy.
|
|
|
|
* XXX To make a simplex device behave exactly like a duplex
|
|
|
|
* device, we should copy in the case of sending to our own
|
|
|
|
* ethernet address (thus letting the original actually appear
|
|
|
|
* on the wire). However, we don't do that here for security
|
|
|
|
* reasons and compatibility with the original behavior.
|
|
|
|
*/
|
2002-03-29 09:52:01 +00:00
|
|
|
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
|
2003-03-15 19:37:44 +00:00
|
|
|
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
|
|
|
|
struct mbuf *n;
|
|
|
|
n = m_copy(m, 0, (int)M_COPYALL);
|
|
|
|
(void) if_simloop(ifp, n, dst->sa_family,
|
|
|
|
FDDI_HDR_LEN);
|
|
|
|
} else if (bcmp(fh->fddi_dhost, fh->fddi_shost,
|
|
|
|
FDDI_ADDR_LEN) == 0) {
|
|
|
|
(void) if_simloop(ifp, m, dst->sa_family,
|
|
|
|
FDDI_HDR_LEN);
|
2002-03-29 08:04:36 +00:00
|
|
|
return (0); /* XXX */
|
1998-06-12 03:48:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-22 07:35:45 +00:00
|
|
|
error = (ifp->if_transmit)(ifp, m);
|
2004-06-15 23:57:42 +00:00
|
|
|
if (error)
|
|
|
|
ifp->if_oerrors++;
|
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
return (error);
|
|
|
|
|
|
|
|
bad:
|
2002-03-29 10:17:06 +00:00
|
|
|
ifp->if_oerrors++;
|
1995-03-14 09:16:07 +00:00
|
|
|
if (m)
|
|
|
|
m_freem(m);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2003-03-16 00:17:44 +00:00
|
|
|
* Process a received FDDI packet.
|
1995-03-14 09:16:07 +00:00
|
|
|
*/
|
2002-11-15 00:00:15 +00:00
|
|
|
static void
|
|
|
|
fddi_input(ifp, m)
|
1995-03-14 09:16:07 +00:00
|
|
|
struct ifnet *ifp;
|
|
|
|
struct mbuf *m;
|
|
|
|
{
|
2003-03-04 23:19:55 +00:00
|
|
|
int isr;
|
2002-03-29 07:12:10 +00:00
|
|
|
struct llc *l;
|
2002-11-15 00:00:15 +00:00
|
|
|
struct fddi_header *fh;
|
|
|
|
|
2003-03-16 00:17:44 +00:00
|
|
|
/*
|
|
|
|
* Do consistency checks to verify assumptions
|
|
|
|
* made by code past this point.
|
|
|
|
*/
|
|
|
|
if ((m->m_flags & M_PKTHDR) == 0) {
|
|
|
|
if_printf(ifp, "discard frame w/o packet header\n");
|
|
|
|
ifp->if_ierrors++;
|
|
|
|
m_freem(m);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (m->m_pkthdr.rcvif == NULL) {
|
|
|
|
if_printf(ifp, "discard frame w/o interface pointer\n");
|
|
|
|
ifp->if_ierrors++;
|
|
|
|
m_freem(m);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m = m_pullup(m, FDDI_HDR_LEN);
|
|
|
|
if (m == NULL) {
|
|
|
|
ifp->if_ierrors++;
|
|
|
|
goto dropanyway;
|
|
|
|
}
|
2002-11-15 00:00:15 +00:00
|
|
|
fh = mtod(m, struct fddi_header *);
|
|
|
|
|
2002-03-29 10:17:06 +00:00
|
|
|
/*
|
|
|
|
* Discard packet if interface is not up.
|
|
|
|
*/
|
2005-08-09 10:20:02 +00:00
|
|
|
if (!((ifp->if_flags & IFF_UP) &&
|
|
|
|
(ifp->if_drv_flags & IFF_DRV_RUNNING)))
|
2002-03-29 10:17:06 +00:00
|
|
|
goto dropanyway;
|
|
|
|
|
2003-03-16 00:17:44 +00:00
|
|
|
/*
|
|
|
|
* Give bpf a chance at the packet.
|
|
|
|
*/
|
|
|
|
BPF_MTAP(ifp, m);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interface marked for monitoring; discard packet.
|
|
|
|
*/
|
|
|
|
if (ifp->if_flags & IFF_MONITOR) {
|
|
|
|
m_freem(m);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-10-20 22:27:59 +00:00
|
|
|
#ifdef MAC
|
2007-10-24 19:04:04 +00:00
|
|
|
mac_ifnet_create_mbuf(ifp, m);
|
2002-10-20 22:27:59 +00:00
|
|
|
#endif
|
|
|
|
|
2003-03-15 21:51:39 +00:00
|
|
|
/*
|
|
|
|
* Update interface statistics.
|
|
|
|
*/
|
|
|
|
ifp->if_ibytes += m->m_pkthdr.len;
|
|
|
|
getmicrotime(&ifp->if_lastchange);
|
|
|
|
|
2002-03-29 10:17:06 +00:00
|
|
|
/*
|
|
|
|
* Discard non local unicast packets when interface
|
|
|
|
* is in promiscuous mode.
|
|
|
|
*/
|
|
|
|
if ((ifp->if_flags & IFF_PROMISC) && ((fh->fddi_dhost[0] & 1) == 0) &&
|
2005-11-11 16:04:59 +00:00
|
|
|
(bcmp(IF_LLADDR(ifp), (caddr_t)fh->fddi_dhost,
|
2002-03-29 10:17:06 +00:00
|
|
|
FDDI_ADDR_LEN) != 0))
|
|
|
|
goto dropanyway;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set mbuf flags for bcast/mcast.
|
|
|
|
*/
|
1997-01-17 23:54:45 +00:00
|
|
|
if (fh->fddi_dhost[0] & 1) {
|
2003-10-23 17:47:55 +00:00
|
|
|
if (bcmp(ifp->if_broadcastaddr, fh->fddi_dhost,
|
|
|
|
FDDI_ADDR_LEN) == 0)
|
1997-01-17 23:54:45 +00:00
|
|
|
m->m_flags |= M_BCAST;
|
|
|
|
else
|
|
|
|
m->m_flags |= M_MCAST;
|
1995-03-14 09:16:07 +00:00
|
|
|
ifp->if_imcasts++;
|
1997-01-17 23:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef M_LINK0
|
|
|
|
/*
|
|
|
|
* If this has a LLC priority of 0, then mark it so upper
|
|
|
|
* layers have a hint that it really came via a FDDI/Ethernet
|
|
|
|
* bridge.
|
|
|
|
*/
|
|
|
|
if ((fh->fddi_fc & FDDIFC_LLC_PRIO7) == FDDIFC_LLC_PRIO0)
|
|
|
|
m->m_flags |= M_LINK0;
|
|
|
|
#endif
|
1995-03-14 09:16:07 +00:00
|
|
|
|
2002-11-15 00:00:15 +00:00
|
|
|
/* Strip off FDDI header. */
|
2003-03-03 05:04:57 +00:00
|
|
|
m_adj(m, FDDI_HDR_LEN);
|
2002-11-15 00:00:15 +00:00
|
|
|
|
2003-03-03 05:04:57 +00:00
|
|
|
m = m_pullup(m, LLC_SNAPFRAMELEN);
|
2002-03-29 10:17:06 +00:00
|
|
|
if (m == 0) {
|
|
|
|
ifp->if_ierrors++;
|
|
|
|
goto dropanyway;
|
|
|
|
}
|
1995-03-14 09:16:07 +00:00
|
|
|
l = mtod(m, struct llc *);
|
2002-03-29 09:52:01 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
switch (l->llc_dsap) {
|
|
|
|
case LLC_SNAP_LSAP:
|
|
|
|
{
|
1997-01-17 23:54:45 +00:00
|
|
|
u_int16_t type;
|
2003-03-15 15:09:11 +00:00
|
|
|
if ((l->llc_control != LLC_UI) ||
|
|
|
|
(l->llc_ssap != LLC_SNAP_LSAP)) {
|
2002-03-29 10:17:06 +00:00
|
|
|
ifp->if_noproto++;
|
1995-03-14 09:16:07 +00:00
|
|
|
goto dropanyway;
|
2002-03-29 10:17:06 +00:00
|
|
|
}
|
2002-03-29 09:52:01 +00:00
|
|
|
if (l->llc_snap.org_code[0] != 0 ||
|
|
|
|
l->llc_snap.org_code[1] != 0 ||
|
2002-03-29 10:17:06 +00:00
|
|
|
l->llc_snap.org_code[2] != 0) {
|
|
|
|
ifp->if_noproto++;
|
1995-03-14 09:16:07 +00:00
|
|
|
goto dropanyway;
|
2002-03-29 10:17:06 +00:00
|
|
|
}
|
2002-03-29 09:52:01 +00:00
|
|
|
|
1997-01-17 23:54:45 +00:00
|
|
|
type = ntohs(l->llc_snap.ether_type);
|
2002-03-29 09:52:01 +00:00
|
|
|
m_adj(m, LLC_SNAPFRAMELEN);
|
|
|
|
|
1997-01-17 23:54:45 +00:00
|
|
|
switch (type) {
|
1995-03-14 09:16:07 +00:00
|
|
|
#ifdef INET
|
|
|
|
case ETHERTYPE_IP:
|
2006-01-18 14:24:39 +00:00
|
|
|
if ((m = ip_fastforward(m)) == NULL)
|
1998-05-19 14:04:36 +00:00
|
|
|
return;
|
2003-03-04 23:19:55 +00:00
|
|
|
isr = NETISR_IP;
|
1995-03-14 09:16:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ETHERTYPE_ARP:
|
2001-06-15 21:00:32 +00:00
|
|
|
if (ifp->if_flags & IFF_NOARP)
|
|
|
|
goto dropanyway;
|
2003-03-04 23:19:55 +00:00
|
|
|
isr = NETISR_ARP;
|
1995-03-14 09:16:07 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1999-12-07 17:39:16 +00:00
|
|
|
#ifdef INET6
|
|
|
|
case ETHERTYPE_IPV6:
|
2003-03-04 23:19:55 +00:00
|
|
|
isr = NETISR_IPV6;
|
1999-12-07 17:39:16 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1995-03-14 09:16:07 +00:00
|
|
|
#ifdef DECNET
|
1997-01-17 23:54:45 +00:00
|
|
|
case ETHERTYPE_DECNET:
|
2003-03-04 23:19:55 +00:00
|
|
|
isr = NETISR_DECNET;
|
1995-03-14 09:16:07 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
1997-01-17 23:54:45 +00:00
|
|
|
/* printf("fddi_input: unknown protocol 0x%x\n", type); */
|
1995-03-14 09:16:07 +00:00
|
|
|
ifp->if_noproto++;
|
|
|
|
goto dropanyway;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1997-01-17 23:54:45 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
default:
|
1997-01-17 23:54:45 +00:00
|
|
|
/* printf("fddi_input: unknown dsap 0x%x\n", l->llc_dsap); */
|
1995-03-14 09:16:07 +00:00
|
|
|
ifp->if_noproto++;
|
2002-03-29 09:52:01 +00:00
|
|
|
goto dropanyway;
|
1995-03-14 09:16:07 +00:00
|
|
|
}
|
2011-07-03 16:08:38 +00:00
|
|
|
M_SETFIB(m, ifp->if_fib);
|
2003-03-04 23:19:55 +00:00
|
|
|
netisr_dispatch(isr, m);
|
2002-03-29 09:52:01 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
dropanyway:
|
|
|
|
ifp->if_iqdrops++;
|
|
|
|
if (m)
|
|
|
|
m_freem(m);
|
|
|
|
return;
|
1995-03-14 09:16:07 +00:00
|
|
|
}
|
2002-03-29 10:23:42 +00:00
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
/*
|
|
|
|
* Perform common duties while attaching to interface list
|
|
|
|
*/
|
|
|
|
void
|
2005-11-11 07:36:14 +00:00
|
|
|
fddi_ifattach(ifp, lla, bpf)
|
2002-03-29 07:12:10 +00:00
|
|
|
struct ifnet *ifp;
|
2005-11-11 07:36:14 +00:00
|
|
|
const u_int8_t *lla;
|
2002-03-29 11:22:22 +00:00
|
|
|
int bpf;
|
1995-03-14 09:16:07 +00:00
|
|
|
{
|
2002-03-29 07:12:10 +00:00
|
|
|
struct ifaddr *ifa;
|
|
|
|
struct sockaddr_dl *sdl;
|
1995-03-14 09:16:07 +00:00
|
|
|
|
|
|
|
ifp->if_type = IFT_FDDI;
|
2002-03-29 08:51:42 +00:00
|
|
|
ifp->if_addrlen = FDDI_ADDR_LEN;
|
1995-03-14 09:16:07 +00:00
|
|
|
ifp->if_hdrlen = 21;
|
2002-03-29 10:17:06 +00:00
|
|
|
|
|
|
|
if_attach(ifp); /* Must be called before additional assignments */
|
|
|
|
|
1995-03-14 09:16:07 +00:00
|
|
|
ifp->if_mtu = FDDIMTU;
|
2002-03-29 10:17:06 +00:00
|
|
|
ifp->if_output = fddi_output;
|
2002-11-15 00:00:15 +00:00
|
|
|
ifp->if_input = fddi_input;
|
2000-11-01 16:57:01 +00:00
|
|
|
ifp->if_resolvemulti = fddi_resolvemulti;
|
2002-03-29 10:17:06 +00:00
|
|
|
ifp->if_broadcastaddr = fddibroadcastaddr;
|
1996-06-01 23:25:10 +00:00
|
|
|
ifp->if_baudrate = 100000000;
|
1997-01-17 23:54:45 +00:00
|
|
|
#ifdef IFF_NOTRAILERS
|
|
|
|
ifp->if_flags |= IFF_NOTRAILERS;
|
|
|
|
#endif
|
2005-11-11 16:04:59 +00:00
|
|
|
ifa = ifp->if_addr;
|
|
|
|
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
|
2002-03-29 10:17:06 +00:00
|
|
|
|
1997-01-17 23:56:20 +00:00
|
|
|
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
|
|
|
|
sdl->sdl_type = IFT_FDDI;
|
|
|
|
sdl->sdl_alen = ifp->if_addrlen;
|
2005-11-11 07:36:14 +00:00
|
|
|
bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
|
2002-03-29 10:17:06 +00:00
|
|
|
|
2002-03-29 11:22:22 +00:00
|
|
|
if (bpf)
|
|
|
|
bpfattach(ifp, DLT_FDDI, FDDI_HDR_LEN);
|
|
|
|
|
2002-03-29 10:17:06 +00:00
|
|
|
return;
|
1995-03-14 09:16:07 +00:00
|
|
|
}
|
2000-11-01 16:57:01 +00:00
|
|
|
|
2002-03-29 10:40:35 +00:00
|
|
|
void
|
|
|
|
fddi_ifdetach(ifp, bpf)
|
|
|
|
struct ifnet *ifp;
|
|
|
|
int bpf;
|
|
|
|
{
|
|
|
|
|
|
|
|
if (bpf)
|
|
|
|
bpfdetach(ifp);
|
|
|
|
|
|
|
|
if_detach(ifp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
fddi_ioctl (ifp, command, data)
|
|
|
|
struct ifnet *ifp;
|
2009-06-21 10:29:31 +00:00
|
|
|
u_long command;
|
2002-03-29 10:40:35 +00:00
|
|
|
caddr_t data;
|
|
|
|
{
|
|
|
|
struct ifaddr *ifa;
|
|
|
|
struct ifreq *ifr;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
ifa = (struct ifaddr *) data;
|
|
|
|
ifr = (struct ifreq *) data;
|
|
|
|
error = 0;
|
|
|
|
|
|
|
|
switch (command) {
|
|
|
|
case SIOCSIFADDR:
|
|
|
|
ifp->if_flags |= IFF_UP;
|
|
|
|
|
|
|
|
switch (ifa->ifa_addr->sa_family) {
|
|
|
|
#ifdef INET
|
|
|
|
case AF_INET: /* before arpwhohas */
|
|
|
|
ifp->if_init(ifp->if_softc);
|
|
|
|
arp_ifinit(ifp, ifa);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
ifp->if_init(ifp->if_softc);
|
|
|
|
break;
|
2002-10-01 15:48:31 +00:00
|
|
|
}
|
2005-03-24 02:08:22 +00:00
|
|
|
break;
|
2002-03-29 10:40:35 +00:00
|
|
|
case SIOCGIFADDR: {
|
|
|
|
struct sockaddr *sa;
|
|
|
|
|
|
|
|
sa = (struct sockaddr *) & ifr->ifr_data;
|
2005-11-11 16:04:59 +00:00
|
|
|
bcopy(IF_LLADDR(ifp),
|
2002-03-29 10:40:35 +00:00
|
|
|
(caddr_t) sa->sa_data, FDDI_ADDR_LEN);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SIOCSIFMTU:
|
|
|
|
/*
|
|
|
|
* Set the interface MTU.
|
|
|
|
*/
|
|
|
|
if (ifr->ifr_mtu > FDDIMTU) {
|
|
|
|
error = EINVAL;
|
|
|
|
} else {
|
|
|
|
ifp->if_mtu = ifr->ifr_mtu;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-03-24 02:08:22 +00:00
|
|
|
error = EINVAL;
|
2002-03-29 10:40:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
2000-11-01 16:57:01 +00:00
|
|
|
static int
|
|
|
|
fddi_resolvemulti(ifp, llsa, sa)
|
|
|
|
struct ifnet *ifp;
|
|
|
|
struct sockaddr **llsa;
|
|
|
|
struct sockaddr *sa;
|
|
|
|
{
|
|
|
|
struct sockaddr_dl *sdl;
|
2008-11-06 09:07:56 +00:00
|
|
|
#ifdef INET
|
2000-11-01 16:57:01 +00:00
|
|
|
struct sockaddr_in *sin;
|
2008-11-06 09:07:56 +00:00
|
|
|
#endif
|
2000-11-01 16:57:01 +00:00
|
|
|
#ifdef INET6
|
|
|
|
struct sockaddr_in6 *sin6;
|
|
|
|
#endif
|
|
|
|
u_char *e_addr;
|
|
|
|
|
|
|
|
switch(sa->sa_family) {
|
|
|
|
case AF_LINK:
|
|
|
|
/*
|
|
|
|
* No mapping needed. Just check that it's a valid MC address.
|
|
|
|
*/
|
|
|
|
sdl = (struct sockaddr_dl *)sa;
|
|
|
|
e_addr = LLADDR(sdl);
|
|
|
|
if ((e_addr[0] & 1) != 1)
|
2002-03-29 08:04:36 +00:00
|
|
|
return (EADDRNOTAVAIL);
|
2000-11-01 16:57:01 +00:00
|
|
|
*llsa = 0;
|
2002-03-29 08:04:36 +00:00
|
|
|
return (0);
|
2000-11-01 16:57:01 +00:00
|
|
|
|
|
|
|
#ifdef INET
|
|
|
|
case AF_INET:
|
|
|
|
sin = (struct sockaddr_in *)sa;
|
|
|
|
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
|
2002-03-29 08:04:36 +00:00
|
|
|
return (EADDRNOTAVAIL);
|
2014-01-18 23:24:51 +00:00
|
|
|
sdl = link_init_sdl(ifp, *llsa, IFT_FDDI);
|
2000-11-01 16:57:01 +00:00
|
|
|
sdl->sdl_nlen = 0;
|
2002-03-29 09:37:56 +00:00
|
|
|
sdl->sdl_alen = FDDI_ADDR_LEN;
|
2000-11-01 16:57:01 +00:00
|
|
|
sdl->sdl_slen = 0;
|
|
|
|
e_addr = LLADDR(sdl);
|
|
|
|
ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr);
|
|
|
|
*llsa = (struct sockaddr *)sdl;
|
2002-03-29 08:04:36 +00:00
|
|
|
return (0);
|
2000-11-01 16:57:01 +00:00
|
|
|
#endif
|
|
|
|
#ifdef INET6
|
|
|
|
case AF_INET6:
|
|
|
|
sin6 = (struct sockaddr_in6 *)sa;
|
|
|
|
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
|
|
|
|
/*
|
|
|
|
* An IP6 address of 0 means listen to all
|
|
|
|
* of the Ethernet multicast address used for IP6.
|
|
|
|
* (This is used for multicast routers.)
|
|
|
|
*/
|
|
|
|
ifp->if_flags |= IFF_ALLMULTI;
|
|
|
|
*llsa = 0;
|
2002-03-29 08:04:36 +00:00
|
|
|
return (0);
|
2000-11-01 16:57:01 +00:00
|
|
|
}
|
|
|
|
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
|
2002-03-29 08:04:36 +00:00
|
|
|
return (EADDRNOTAVAIL);
|
2014-01-18 23:24:51 +00:00
|
|
|
sdl = link_init_sdl(ifp, *llsa, IFT_FDDI);
|
2000-11-01 16:57:01 +00:00
|
|
|
sdl->sdl_nlen = 0;
|
2002-03-29 09:37:56 +00:00
|
|
|
sdl->sdl_alen = FDDI_ADDR_LEN;
|
2000-11-01 16:57:01 +00:00
|
|
|
sdl->sdl_slen = 0;
|
|
|
|
e_addr = LLADDR(sdl);
|
|
|
|
ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr);
|
|
|
|
*llsa = (struct sockaddr *)sdl;
|
2002-03-29 08:04:36 +00:00
|
|
|
return (0);
|
2000-11-01 16:57:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* Well, the text isn't quite right, but it's the name
|
|
|
|
* that counts...
|
|
|
|
*/
|
2002-03-29 08:04:36 +00:00
|
|
|
return (EAFNOSUPPORT);
|
2000-11-01 16:57:01 +00:00
|
|
|
}
|
2002-03-29 09:37:56 +00:00
|
|
|
|
|
|
|
return (0);
|
2000-11-01 16:57:01 +00:00
|
|
|
}
|
2002-03-29 09:37:56 +00:00
|
|
|
|
|
|
|
static moduledata_t fddi_mod = {
|
|
|
|
"fddi", /* module name */
|
|
|
|
NULL, /* event handler */
|
2012-10-10 08:36:38 +00:00
|
|
|
0 /* extra data */
|
2002-03-29 09:37:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_MODULE(fddi, fddi_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
|
|
|
|
MODULE_VERSION(fddi, 1);
|