2 * Copyright (c) 1982, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
37 #include "opt_atalk.h"
39 #include "opt_inet6.h"
42 #include "opt_netgraph.h"
44 #include <sys/param.h>
45 #include <sys/systm.h>
46 #include <sys/kernel.h>
47 #include <sys/malloc.h>
49 #include <sys/random.h>
50 #include <sys/socket.h>
51 #include <sys/sockio.h>
52 #include <sys/sysctl.h>
55 #include <net/netisr.h>
56 #include <net/route.h>
57 #include <net/if_llc.h>
58 #include <net/if_dl.h>
59 #include <net/if_types.h>
61 #include <net/ethernet.h>
62 #include <net/bridge.h>
64 #if defined(INET) || defined(INET6)
65 #include <netinet/in.h>
66 #include <netinet/in_var.h>
67 #include <netinet/if_ether.h>
70 #include <netinet6/nd6.h>
74 #include <netipx/ipx.h>
75 #include <netipx/ipx_if.h>
76 int (*ef_inputp)(struct ifnet*, struct ether_header *eh, struct mbuf *m);
77 int (*ef_outputp)(struct ifnet *ifp, struct mbuf **mp,
78 struct sockaddr *dst, short *tp, int *hlen);
83 #include <netns/ns_if.h>
85 int ether_outputdebug = 0;
86 int ether_inputdebug = 0;
90 #include <netatalk/at.h>
91 #include <netatalk/at_var.h>
92 #include <netatalk/at_extern.h>
94 #define llc_snap_org_code llc_un.type_snap.org_code
95 #define llc_snap_ether_type llc_un.type_snap.ether_type
97 extern u_char at_org_code[3];
98 extern u_char aarp_org_code[3];
101 /* netgraph node hooks for ng_ether(4) */
102 void (*ng_ether_input_p)(struct ifnet *ifp,
103 struct mbuf **mp, struct ether_header *eh);
104 void (*ng_ether_input_orphan_p)(struct ifnet *ifp,
105 struct mbuf *m, struct ether_header *eh);
106 int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp);
107 void (*ng_ether_attach_p)(struct ifnet *ifp);
108 void (*ng_ether_detach_p)(struct ifnet *ifp);
110 int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m);
111 int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m,
116 bridge_in_t *bridge_in_ptr;
117 bdg_forward_t *bdg_forward_ptr;
118 bdgtakeifaces_t *bdgtakeifaces_ptr;
119 struct bdg_softc *ifp2sc;
121 static int ether_resolvemulti __P((struct ifnet *, struct sockaddr **,
123 u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
124 #define senderr(e) do { error = (e); goto bad;} while (0)
125 #define IFP2AC(IFP) ((struct arpcom *)IFP)
128 * Ethernet output routine.
129 * Encapsulate a packet of type family for the local net.
130 * Use trailer local net encapsulation if enough data in first
131 * packet leaves a multiple of 512 bytes of data in remainder.
132 * Assumes that ifp is actually pointer to arpcom structure.
135 ether_output(ifp, m, dst, rt0)
136 register struct ifnet *ifp;
138 struct sockaddr *dst;
142 int error = 0, hdrcmplt = 0;
143 u_char esrc[6], edst[6];
144 register struct rtentry *rt;
145 register struct ether_header *eh;
146 int off, loop_copy = 0;
147 int hlen; /* link layer header lenght */
148 struct arpcom *ac = IFP2AC(ifp);
150 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
154 if ((rt->rt_flags & RTF_UP) == 0) {
155 rt0 = rt = rtalloc1(dst, 1, 0UL);
159 senderr(EHOSTUNREACH);
161 if (rt->rt_flags & RTF_GATEWAY) {
162 if (rt->rt_gwroute == 0)
164 if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
165 rtfree(rt); rt = rt0;
166 lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1,
168 if ((rt = rt->rt_gwroute) == 0)
169 senderr(EHOSTUNREACH);
172 if (rt->rt_flags & RTF_REJECT)
173 if (rt->rt_rmx.rmx_expire == 0 ||
174 time_second < rt->rt_rmx.rmx_expire)
175 senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
177 hlen = ETHER_HDR_LEN;
178 switch (dst->sa_family) {
181 if (!arpresolve(ifp, rt, m, dst, edst, rt0))
182 return (0); /* if not yet resolved */
183 off = m->m_pkthdr.len - m->m_len;
184 type = htons(ETHERTYPE_IP);
189 if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) {
190 /* Something bad happened */
193 off = m->m_pkthdr.len - m->m_len;
194 type = htons(ETHERTYPE_IPV6);
200 error = ef_outputp(ifp, &m, dst, &type, &hlen);
204 type = htons(ETHERTYPE_IPX);
205 bcopy((caddr_t)&(((struct sockaddr_ipx *)dst)->sipx_addr.x_host),
206 (caddr_t)edst, sizeof (edst));
212 struct at_ifaddr *aa;
214 if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) {
217 if (!aarpresolve(ac, m, (struct sockaddr_at *)dst, edst))
220 * In the phase 2 case, need to prepend an mbuf for the llc header.
221 * Since we must preserve the value of m, which is passed to us by
222 * value, we m_copy() the first mbuf, and use it for our llc header.
224 if ( aa->aa_flags & AFA_PHASE2 ) {
227 M_PREPEND(m, sizeof(struct llc), M_TRYWAIT);
228 llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP;
229 llc.llc_control = LLC_UI;
230 bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code));
231 llc.llc_snap_ether_type = htons( ETHERTYPE_AT );
232 bcopy(&llc, mtod(m, caddr_t), sizeof(struct llc));
233 type = htons(m->m_pkthdr.len);
234 hlen = sizeof(struct llc) + ETHER_HDR_LEN;
236 type = htons(ETHERTYPE_AT);
240 #endif /* NETATALK */
245 case 0x8137: /* Novell Ethernet_II Ethernet TYPE II */
248 case 0x0: /* Novell 802.3 */
249 type = htons( m->m_pkthdr.len);
251 case 0xe0e0: /* Novell 802.2 and Token-Ring */
252 M_PREPEND(m, 3, M_TRYWAIT);
253 type = htons( m->m_pkthdr.len);
254 cp = mtod(m, u_char *);
260 bcopy((caddr_t)&(((struct sockaddr_ns *)dst)->sns_addr.x_host),
261 (caddr_t)edst, sizeof (edst));
263 * XXX if ns_thishost is the same as the node's ethernet
264 * address then just the default code will catch this anyhow.
265 * So I'm not sure if this next clause should be here at all?
268 if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst))){
269 m->m_pkthdr.rcvif = ifp;
271 if (IF_HANDOFF(inq, m, NULL))
272 schednetisr(NETISR_NS);
275 if (!bcmp((caddr_t)edst, (caddr_t)&ns_broadhost, sizeof(edst))){
276 m->m_flags |= M_BCAST;
281 case pseudo_AF_HDRCMPLT:
283 eh = (struct ether_header *)dst->sa_data;
284 (void)memcpy(esrc, eh->ether_shost, sizeof (esrc));
288 loop_copy = -1; /* if this is for us, don't do it */
289 eh = (struct ether_header *)dst->sa_data;
290 (void)memcpy(edst, eh->ether_dhost, sizeof (edst));
291 type = eh->ether_type;
295 printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
297 senderr(EAFNOSUPPORT);
301 * Add local net header. If no space in first mbuf,
304 M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT);
307 eh = mtod(m, struct ether_header *);
308 (void)memcpy(&eh->ether_type, &type,
309 sizeof(eh->ether_type));
310 (void)memcpy(eh->ether_dhost, edst, sizeof (edst));
312 (void)memcpy(eh->ether_shost, esrc,
313 sizeof(eh->ether_shost));
315 (void)memcpy(eh->ether_shost, ac->ac_enaddr,
316 sizeof(eh->ether_shost));
319 * If a simplex interface, and the packet is being sent to our
320 * Ethernet address or a broadcast address, loopback a copy.
321 * XXX To make a simplex device behave exactly like a duplex
322 * device, we should copy in the case of sending to our own
323 * ethernet address (thus letting the original actually appear
324 * on the wire). However, we don't do that here for security
325 * reasons and compatibility with the original behavior.
327 if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
330 if (m->m_pkthdr.csum_flags & CSUM_IP)
331 csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID);
332 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
333 csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
334 if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
335 struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
337 n->m_pkthdr.csum_flags |= csum_flags;
338 if (csum_flags & CSUM_DATA_VALID)
339 n->m_pkthdr.csum_data = 0xffff;
341 (void) if_simloop(ifp, n, dst->sa_family, hlen);
342 } else if (bcmp(eh->ether_dhost,
343 eh->ether_shost, ETHER_ADDR_LEN) == 0) {
344 m->m_pkthdr.csum_flags |= csum_flags;
345 if (csum_flags & CSUM_DATA_VALID)
346 m->m_pkthdr.csum_data = 0xffff;
347 (void) if_simloop(ifp, m, dst->sa_family, hlen);
348 return (0); /* XXX */
352 /* Handle ng_ether(4) processing, if any */
353 if (ng_ether_output_p != NULL) {
354 if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) {
363 /* Continue with link-layer output */
364 return ether_output_frame(ifp, m);
368 * Ethernet link layer output routine to send a raw frame to the device.
370 * This assumes that the 14 byte Ethernet header is present and contiguous
371 * in the first mbuf (if BRIDGE'ing).
374 ether_output_frame(ifp, m)
380 if (BDG_ACTIVE(ifp) ) {
381 struct ether_header *eh; /* a ptr suffices */
383 m->m_pkthdr.rcvif = NULL;
384 eh = mtod(m, struct ether_header *);
385 m_adj(m, ETHER_HDR_LEN);
386 m = bdg_forward_ptr(m, eh, ifp);
393 * Queue message on interface, update output statistics if
394 * successful, and start output if interface not yet active.
396 if (! IF_HANDOFF(&ifp->if_snd, m, ifp))
402 * Process a received Ethernet packet;
403 * the packet is in the mbuf chain m without
404 * the ether header, which is provided separately.
406 * NOTA BENE: for many drivers "eh" is a pointer into the first mbuf or
407 * cluster, right before m_data. So be very careful when working on m,
408 * as you could destroy *eh !!
409 * A (probably) more convenient and efficient interface to ether_input
410 * is to have the whole packet (with the ethernet header) into the mbuf:
411 * modules which do not need the ethernet header can easily drop it, while
412 * others (most noticeably bridge and ng_ether) do not need to do additional
413 * work to put the ethernet header back into the mbuf.
415 * First we perform any link layer operations, then continue
416 * to the upper layers with ether_demux().
419 ether_input(ifp, eh, m)
421 struct ether_header *eh;
424 struct ether_header save_eh;
426 /* Check for a BPF tap */
427 if (ifp->if_bpf != NULL) {
430 /* This kludge is OK; BPF treats the "mbuf" as read-only */
432 mh.mh_data = (char *)eh;
433 mh.mh_len = ETHER_HDR_LEN;
434 bpf_mtap(ifp, (struct mbuf *)&mh);
437 ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
439 /* Handle ng_ether(4) processing, if any */
440 if (ng_ether_input_p != NULL) {
441 (*ng_ether_input_p)(ifp, &m, eh);
446 /* Check for bridging mode */
447 if (BDG_ACTIVE(ifp) ) {
450 /* Check with bridging code */
451 if ((bif = bridge_in_ptr(ifp, eh)) == BDG_DROP) {
455 if (bif != BDG_LOCAL) {
456 struct mbuf *oldm = m ;
458 save_eh = *eh ; /* because it might change */
459 m = bdg_forward_ptr(m, eh, bif); /* needs forwarding */
461 * Do not continue if bdg_forward_ptr() processed our
462 * packet (and cleared the mbuf pointer m) or if
463 * it dropped (m_free'd) the packet itself.
466 if (bif == BDG_BCAST || bif == BDG_MCAST)
467 printf("bdg_forward drop MULTICAST PKT\n");
470 if (m != oldm) /* m changed! */
476 goto recvLocal; /* receive locally */
478 /* If not local and not multicast, just drop it */
485 /* Continue with upper layer processing */
486 ether_demux(ifp, eh, m);
487 /* First chunk of an mbuf contains good junk */
488 if (harvest.ethernet)
489 random_harvest(m, 16, 3, 0, RANDOM_NET);
493 * Upper layer processing for a received Ethernet packet.
496 ether_demux(ifp, eh, m)
498 struct ether_header *eh;
503 #if defined(NETATALK)
504 register struct llc *l;
507 if (! (BDG_ACTIVE(ifp) ) )
508 /* Discard packet if upper layers shouldn't see it because it was
509 unicast to a different Ethernet address. If the driver is working
510 properly, then this situation can only happen when the interface
511 is in promiscuous mode. */
512 if ((ifp->if_flags & IFF_PROMISC) != 0
513 && (eh->ether_dhost[0] & 1) == 0
514 && bcmp(eh->ether_dhost,
515 IFP2AC(ifp)->ac_enaddr, ETHER_ADDR_LEN) != 0) {
520 /* Discard packet if interface is not up */
521 if ((ifp->if_flags & IFF_UP) == 0) {
525 if (eh->ether_dhost[0] & 1) {
526 if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
527 sizeof(etherbroadcastaddr)) == 0)
528 m->m_flags |= M_BCAST;
530 m->m_flags |= M_MCAST;
532 if (m->m_flags & (M_BCAST|M_MCAST))
535 ether_type = ntohs(eh->ether_type);
537 switch (ether_type) {
540 if (ipflow_fastforward(m))
542 schednetisr(NETISR_IP);
547 if (ifp->if_flags & IFF_NOARP) {
548 /* Discard packet if ARP is disabled on interface */
552 schednetisr(NETISR_ARP);
558 if (ef_inputp && ef_inputp(ifp, eh, m) == 0)
560 schednetisr(NETISR_IPX);
566 schednetisr(NETISR_IPV6);
571 case 0x8137: /* Novell Ethernet_II Ethernet TYPE II */
572 schednetisr(NETISR_NS);
579 schednetisr(NETISR_ATALK);
583 /* probably this should be done with a NETISR as well */
584 aarpinput(IFP2AC(ifp), m); /* XXX */
586 #endif /* NETATALK */
592 if (ef_inputp && ef_inputp(ifp, eh, m) == 0)
596 checksum = mtod(m, ushort *);
598 if ((ether_type <= ETHERMTU) &&
599 ((*checksum == 0xffff) || (*checksum == 0xE0E0))){
600 if(*checksum == 0xE0E0) {
601 m->m_pkthdr.len -= 3;
605 schednetisr(NETISR_NS);
610 #if defined(NETATALK)
611 if (ether_type > ETHERMTU)
613 l = mtod(m, struct llc *);
614 switch (l->llc_dsap) {
616 switch (l->llc_control) {
618 if (l->llc_ssap != LLC_SNAP_LSAP)
621 if (Bcmp(&(l->llc_snap_org_code)[0], at_org_code,
622 sizeof(at_org_code)) == 0 &&
623 ntohs(l->llc_snap_ether_type) == ETHERTYPE_AT) {
625 m_adj( m, sizeof( struct llc ));
626 schednetisr(NETISR_ATALK);
630 if (Bcmp(&(l->llc_snap_org_code)[0], aarp_org_code,
631 sizeof(aarp_org_code)) == 0 &&
632 ntohs(l->llc_snap_ether_type) == ETHERTYPE_AARP) {
633 m_adj( m, sizeof( struct llc ));
634 aarpinput(IFP2AC(ifp), m); /* XXX */
644 if (ng_ether_input_orphan_p != NULL)
645 (*ng_ether_input_orphan_p)(ifp, m, eh);
651 if (ng_ether_input_orphan_p != NULL)
652 (*ng_ether_input_orphan_p)(ifp, m, eh);
656 #endif /* NETATALK */
659 (void) IF_HANDOFF(inq, m, NULL);
663 * Perform common duties while attaching to interface list
666 ether_ifattach(ifp, bpf)
667 register struct ifnet *ifp;
670 register struct ifaddr *ifa;
671 register struct sockaddr_dl *sdl;
673 ifp->if_type = IFT_ETHER;
677 ifp->if_mtu = ETHERMTU;
678 ifp->if_resolvemulti = ether_resolvemulti;
679 if (ifp->if_baudrate == 0)
680 ifp->if_baudrate = 10000000;
681 ifp->if_broadcastaddr = etherbroadcastaddr;
682 ifa = ifaddr_byindex(ifp->if_index);
683 KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__));
684 sdl = (struct sockaddr_dl *)ifa->ifa_addr;
685 sdl->sdl_type = IFT_ETHER;
686 sdl->sdl_alen = ifp->if_addrlen;
687 bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen);
689 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
690 if (ng_ether_attach_p != NULL)
691 (*ng_ether_attach_p)(ifp);
697 * Perform common duties while detaching an Ethernet interface
700 ether_ifdetach(ifp, bpf)
704 if (ng_ether_detach_p != NULL)
705 (*ng_ether_detach_p)(ifp);
713 SYSCTL_DECL(_net_link);
714 SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet");
717 ether_ioctl(ifp, command, data)
722 struct ifaddr *ifa = (struct ifaddr *) data;
723 struct ifreq *ifr = (struct ifreq *) data;
728 ifp->if_flags |= IFF_UP;
730 switch (ifa->ifa_addr->sa_family) {
733 ifp->if_init(ifp->if_softc); /* before arpwhohas */
734 arp_ifinit(ifp, ifa);
739 * XXX - This code is probably wrong
743 register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
744 struct arpcom *ac = IFP2AC(ifp);
746 if (ipx_nullhost(*ina))
751 bcopy((caddr_t) ina->x_host.c_host,
752 (caddr_t) ac->ac_enaddr,
753 sizeof(ac->ac_enaddr));
759 ifp->if_init(ifp->if_softc);
765 * XXX - This code is probably wrong
769 register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
770 struct arpcom *ac = IFP2AC(ifp);
772 if (ns_nullhost(*ina))
774 *(union ns_host *) (ac->ac_enaddr);
776 bcopy((caddr_t) ina->x_host.c_host,
777 (caddr_t) ac->ac_enaddr,
778 sizeof(ac->ac_enaddr));
784 ifp->if_init(ifp->if_softc);
789 ifp->if_init(ifp->if_softc);
798 sa = (struct sockaddr *) & ifr->ifr_data;
799 bcopy(IFP2AC(ifp)->ac_enaddr,
800 (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
806 * Set the interface MTU.
808 if (ifr->ifr_mtu > ETHERMTU) {
811 ifp->if_mtu = ifr->ifr_mtu;
819 ether_resolvemulti(ifp, llsa, sa)
821 struct sockaddr **llsa;
824 struct sockaddr_dl *sdl;
825 struct sockaddr_in *sin;
827 struct sockaddr_in6 *sin6;
831 switch(sa->sa_family) {
834 * No mapping needed. Just check that it's a valid MC address.
836 sdl = (struct sockaddr_dl *)sa;
837 e_addr = LLADDR(sdl);
838 if ((e_addr[0] & 1) != 1)
839 return EADDRNOTAVAIL;
845 sin = (struct sockaddr_in *)sa;
846 if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
847 return EADDRNOTAVAIL;
848 MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
850 sdl->sdl_len = sizeof *sdl;
851 sdl->sdl_family = AF_LINK;
852 sdl->sdl_index = ifp->if_index;
853 sdl->sdl_type = IFT_ETHER;
854 sdl->sdl_alen = ETHER_ADDR_LEN;
855 e_addr = LLADDR(sdl);
856 ETHER_MAP_IP_MULTICAST(&sin->sin_addr, e_addr);
857 *llsa = (struct sockaddr *)sdl;
862 sin6 = (struct sockaddr_in6 *)sa;
863 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
865 * An IP6 address of 0 means listen to all
866 * of the Ethernet multicast address used for IP6.
867 * (This is used for multicast routers.)
869 ifp->if_flags |= IFF_ALLMULTI;
873 if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
874 return EADDRNOTAVAIL;
875 MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
877 sdl->sdl_len = sizeof *sdl;
878 sdl->sdl_family = AF_LINK;
879 sdl->sdl_index = ifp->if_index;
880 sdl->sdl_type = IFT_ETHER;
881 sdl->sdl_alen = ETHER_ADDR_LEN;
882 e_addr = LLADDR(sdl);
883 ETHER_MAP_IPV6_MULTICAST(&sin6->sin6_addr, e_addr);
884 *llsa = (struct sockaddr *)sdl;
890 * Well, the text isn't quite right, but it's the name