1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1982, 1989, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 6df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 7df8bae1dSRodney W. Grimes * are met: 8df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 9df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 10df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 11df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 12df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 13df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 14df8bae1dSRodney W. Grimes * must display the following acknowledgement: 15df8bae1dSRodney W. Grimes * This product includes software developed by the University of 16df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 17df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 18df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 19df8bae1dSRodney W. Grimes * without specific prior written permission. 20df8bae1dSRodney W. Grimes * 21df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31df8bae1dSRodney W. Grimes * SUCH DAMAGE. 32df8bae1dSRodney W. Grimes * 33df8bae1dSRodney W. Grimes * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 34995add1aSGarrett Wollman * $Id: if_ethersubr.c,v 1.4 1994/11/24 14:29:38 davidg Exp $ 35df8bae1dSRodney W. Grimes */ 36df8bae1dSRodney W. Grimes 37df8bae1dSRodney W. Grimes #include <sys/param.h> 38df8bae1dSRodney W. Grimes #include <sys/systm.h> 39df8bae1dSRodney W. Grimes #include <sys/kernel.h> 40df8bae1dSRodney W. Grimes #include <sys/malloc.h> 41df8bae1dSRodney W. Grimes #include <sys/mbuf.h> 42df8bae1dSRodney W. Grimes #include <sys/protosw.h> 43df8bae1dSRodney W. Grimes #include <sys/socket.h> 44df8bae1dSRodney W. Grimes #include <sys/ioctl.h> 45df8bae1dSRodney W. Grimes #include <sys/errno.h> 46df8bae1dSRodney W. Grimes #include <sys/syslog.h> 47df8bae1dSRodney W. Grimes 48df8bae1dSRodney W. Grimes #include <machine/cpu.h> 49df8bae1dSRodney W. Grimes 50df8bae1dSRodney W. Grimes #include <net/if.h> 51df8bae1dSRodney W. Grimes #include <net/netisr.h> 52df8bae1dSRodney W. Grimes #include <net/route.h> 53df8bae1dSRodney W. Grimes #include <net/if_llc.h> 54df8bae1dSRodney W. Grimes #include <net/if_dl.h> 55df8bae1dSRodney W. Grimes #include <net/if_types.h> 56df8bae1dSRodney W. Grimes 57df8bae1dSRodney W. Grimes #ifdef INET 58df8bae1dSRodney W. Grimes #include <netinet/in.h> 59df8bae1dSRodney W. Grimes #include <netinet/in_var.h> 60df8bae1dSRodney W. Grimes #endif 61df8bae1dSRodney W. Grimes #include <netinet/if_ether.h> 62df8bae1dSRodney W. Grimes 63df8bae1dSRodney W. Grimes #ifdef NS 64df8bae1dSRodney W. Grimes #include <netns/ns.h> 65df8bae1dSRodney W. Grimes #include <netns/ns_if.h> 66df8bae1dSRodney W. Grimes #endif 67df8bae1dSRodney W. Grimes 68df8bae1dSRodney W. Grimes #ifdef ISO 69df8bae1dSRodney W. Grimes #include <netiso/argo_debug.h> 70df8bae1dSRodney W. Grimes #include <netiso/iso.h> 71df8bae1dSRodney W. Grimes #include <netiso/iso_var.h> 72df8bae1dSRodney W. Grimes #include <netiso/iso_snpac.h> 73df8bae1dSRodney W. Grimes #endif 74df8bae1dSRodney W. Grimes 75df8bae1dSRodney W. Grimes #ifdef LLC 76df8bae1dSRodney W. Grimes #include <netccitt/dll.h> 77df8bae1dSRodney W. Grimes #include <netccitt/llc_var.h> 78df8bae1dSRodney W. Grimes #endif 79df8bae1dSRodney W. Grimes 80df8bae1dSRodney W. Grimes #if defined(LLC) && defined(CCITT) 81df8bae1dSRodney W. Grimes extern struct ifqueue pkintrq; 82df8bae1dSRodney W. Grimes #endif 83df8bae1dSRodney W. Grimes 84df8bae1dSRodney W. Grimes u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 85df8bae1dSRodney W. Grimes extern struct ifnet loif; 86df8bae1dSRodney W. Grimes #define senderr(e) { error = (e); goto bad;} 87df8bae1dSRodney W. Grimes 88df8bae1dSRodney W. Grimes /* 89df8bae1dSRodney W. Grimes * Ethernet output routine. 90df8bae1dSRodney W. Grimes * Encapsulate a packet of type family for the local net. 91df8bae1dSRodney W. Grimes * Use trailer local net encapsulation if enough data in first 92df8bae1dSRodney W. Grimes * packet leaves a multiple of 512 bytes of data in remainder. 93df8bae1dSRodney W. Grimes * Assumes that ifp is actually pointer to arpcom structure. 94df8bae1dSRodney W. Grimes */ 95df8bae1dSRodney W. Grimes int 96df8bae1dSRodney W. Grimes ether_output(ifp, m0, dst, rt0) 97df8bae1dSRodney W. Grimes register struct ifnet *ifp; 98df8bae1dSRodney W. Grimes struct mbuf *m0; 99df8bae1dSRodney W. Grimes struct sockaddr *dst; 100df8bae1dSRodney W. Grimes struct rtentry *rt0; 101df8bae1dSRodney W. Grimes { 102df8bae1dSRodney W. Grimes short type; 103df8bae1dSRodney W. Grimes int s, error = 0; 104df8bae1dSRodney W. Grimes u_char edst[6]; 105df8bae1dSRodney W. Grimes register struct mbuf *m = m0; 106df8bae1dSRodney W. Grimes register struct rtentry *rt; 107df8bae1dSRodney W. Grimes struct mbuf *mcopy = (struct mbuf *)0; 108df8bae1dSRodney W. Grimes register struct ether_header *eh; 109df8bae1dSRodney W. Grimes int off, len = m->m_pkthdr.len; 110df8bae1dSRodney W. Grimes struct arpcom *ac = (struct arpcom *)ifp; 111df8bae1dSRodney W. Grimes 112df8bae1dSRodney W. Grimes if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) 113df8bae1dSRodney W. Grimes senderr(ENETDOWN); 114df8bae1dSRodney W. Grimes ifp->if_lastchange = time; 115df8bae1dSRodney W. Grimes if (rt = rt0) { 116df8bae1dSRodney W. Grimes if ((rt->rt_flags & RTF_UP) == 0) { 117995add1aSGarrett Wollman if (rt0 = rt = rtalloc1(dst, 1, 0UL)) 118df8bae1dSRodney W. Grimes rt->rt_refcnt--; 119df8bae1dSRodney W. Grimes else 120df8bae1dSRodney W. Grimes senderr(EHOSTUNREACH); 121df8bae1dSRodney W. Grimes } 122df8bae1dSRodney W. Grimes if (rt->rt_flags & RTF_GATEWAY) { 123df8bae1dSRodney W. Grimes if (rt->rt_gwroute == 0) 124df8bae1dSRodney W. Grimes goto lookup; 125df8bae1dSRodney W. Grimes if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { 126df8bae1dSRodney W. Grimes rtfree(rt); rt = rt0; 127995add1aSGarrett Wollman lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 128995add1aSGarrett Wollman 0UL); 129df8bae1dSRodney W. Grimes if ((rt = rt->rt_gwroute) == 0) 130df8bae1dSRodney W. Grimes senderr(EHOSTUNREACH); 131df8bae1dSRodney W. Grimes } 132df8bae1dSRodney W. Grimes } 133df8bae1dSRodney W. Grimes if (rt->rt_flags & RTF_REJECT) 134df8bae1dSRodney W. Grimes if (rt->rt_rmx.rmx_expire == 0 || 135df8bae1dSRodney W. Grimes time.tv_sec < rt->rt_rmx.rmx_expire) 136df8bae1dSRodney W. Grimes senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); 137df8bae1dSRodney W. Grimes } 138df8bae1dSRodney W. Grimes switch (dst->sa_family) { 139df8bae1dSRodney W. Grimes 140df8bae1dSRodney W. Grimes #ifdef INET 141df8bae1dSRodney W. Grimes case AF_INET: 1425df72964SGarrett Wollman if (!arpresolve(ac, rt, m, dst, edst, rt0)) 143df8bae1dSRodney W. Grimes return (0); /* if not yet resolved */ 144df8bae1dSRodney W. Grimes /* If broadcasting on a simplex interface, loopback a copy */ 145df8bae1dSRodney W. Grimes if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) 146df8bae1dSRodney W. Grimes mcopy = m_copy(m, 0, (int)M_COPYALL); 147df8bae1dSRodney W. Grimes off = m->m_pkthdr.len - m->m_len; 148df8bae1dSRodney W. Grimes type = ETHERTYPE_IP; 149df8bae1dSRodney W. Grimes break; 150df8bae1dSRodney W. Grimes #endif 151df8bae1dSRodney W. Grimes #ifdef NS 152df8bae1dSRodney W. Grimes case AF_NS: 153df8bae1dSRodney W. Grimes type = ETHERTYPE_NS; 154df8bae1dSRodney W. Grimes bcopy((caddr_t)&(((struct sockaddr_ns *)dst)->sns_addr.x_host), 155df8bae1dSRodney W. Grimes (caddr_t)edst, sizeof (edst)); 156df8bae1dSRodney W. Grimes if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst))) 157df8bae1dSRodney W. Grimes return (looutput(ifp, m, dst, rt)); 158df8bae1dSRodney W. Grimes /* If broadcasting on a simplex interface, loopback a copy */ 159df8bae1dSRodney W. Grimes if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) 160df8bae1dSRodney W. Grimes mcopy = m_copy(m, 0, (int)M_COPYALL); 161df8bae1dSRodney W. Grimes break; 162df8bae1dSRodney W. Grimes #endif 163df8bae1dSRodney W. Grimes #ifdef ISO 164df8bae1dSRodney W. Grimes case AF_ISO: { 165df8bae1dSRodney W. Grimes int snpalen; 166df8bae1dSRodney W. Grimes struct llc *l; 167df8bae1dSRodney W. Grimes register struct sockaddr_dl *sdl; 168df8bae1dSRodney W. Grimes 169df8bae1dSRodney W. Grimes if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway) && 170df8bae1dSRodney W. Grimes sdl->sdl_family == AF_LINK && sdl->sdl_alen > 0) { 171df8bae1dSRodney W. Grimes bcopy(LLADDR(sdl), (caddr_t)edst, sizeof(edst)); 172df8bae1dSRodney W. Grimes } else if (error = 173df8bae1dSRodney W. Grimes iso_snparesolve(ifp, (struct sockaddr_iso *)dst, 174df8bae1dSRodney W. Grimes (char *)edst, &snpalen)) 175df8bae1dSRodney W. Grimes goto bad; /* Not Resolved */ 176df8bae1dSRodney W. Grimes /* If broadcasting on a simplex interface, loopback a copy */ 177df8bae1dSRodney W. Grimes if (*edst & 1) 178df8bae1dSRodney W. Grimes m->m_flags |= (M_BCAST|M_MCAST); 179df8bae1dSRodney W. Grimes if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && 180df8bae1dSRodney W. Grimes (mcopy = m_copy(m, 0, (int)M_COPYALL))) { 181df8bae1dSRodney W. Grimes M_PREPEND(mcopy, sizeof (*eh), M_DONTWAIT); 182df8bae1dSRodney W. Grimes if (mcopy) { 183df8bae1dSRodney W. Grimes eh = mtod(mcopy, struct ether_header *); 184df8bae1dSRodney W. Grimes bcopy((caddr_t)edst, 185df8bae1dSRodney W. Grimes (caddr_t)eh->ether_dhost, sizeof (edst)); 186df8bae1dSRodney W. Grimes bcopy((caddr_t)ac->ac_enaddr, 187df8bae1dSRodney W. Grimes (caddr_t)eh->ether_shost, sizeof (edst)); 188df8bae1dSRodney W. Grimes } 189df8bae1dSRodney W. Grimes } 190df8bae1dSRodney W. Grimes M_PREPEND(m, 3, M_DONTWAIT); 191df8bae1dSRodney W. Grimes if (m == NULL) 192df8bae1dSRodney W. Grimes return (0); 193df8bae1dSRodney W. Grimes type = m->m_pkthdr.len; 194df8bae1dSRodney W. Grimes l = mtod(m, struct llc *); 195df8bae1dSRodney W. Grimes l->llc_dsap = l->llc_ssap = LLC_ISO_LSAP; 196df8bae1dSRodney W. Grimes l->llc_control = LLC_UI; 197df8bae1dSRodney W. Grimes len += 3; 198df8bae1dSRodney W. Grimes IFDEBUG(D_ETHER) 199df8bae1dSRodney W. Grimes int i; 200df8bae1dSRodney W. Grimes printf("unoutput: sending pkt to: "); 201df8bae1dSRodney W. Grimes for (i=0; i<6; i++) 202df8bae1dSRodney W. Grimes printf("%x ", edst[i] & 0xff); 203df8bae1dSRodney W. Grimes printf("\n"); 204df8bae1dSRodney W. Grimes ENDDEBUG 205df8bae1dSRodney W. Grimes } break; 206df8bae1dSRodney W. Grimes #endif /* ISO */ 207df8bae1dSRodney W. Grimes #ifdef LLC 208df8bae1dSRodney W. Grimes /* case AF_NSAP: */ 209df8bae1dSRodney W. Grimes case AF_CCITT: { 210df8bae1dSRodney W. Grimes register struct sockaddr_dl *sdl = 211df8bae1dSRodney W. Grimes (struct sockaddr_dl *) rt -> rt_gateway; 212df8bae1dSRodney W. Grimes 213df8bae1dSRodney W. Grimes if (sdl && sdl->sdl_family == AF_LINK 214df8bae1dSRodney W. Grimes && sdl->sdl_alen > 0) { 215df8bae1dSRodney W. Grimes bcopy(LLADDR(sdl), (char *)edst, 216df8bae1dSRodney W. Grimes sizeof(edst)); 217df8bae1dSRodney W. Grimes } else goto bad; /* Not a link interface ? Funny ... */ 218df8bae1dSRodney W. Grimes if ((ifp->if_flags & IFF_SIMPLEX) && (*edst & 1) && 219df8bae1dSRodney W. Grimes (mcopy = m_copy(m, 0, (int)M_COPYALL))) { 220df8bae1dSRodney W. Grimes M_PREPEND(mcopy, sizeof (*eh), M_DONTWAIT); 221df8bae1dSRodney W. Grimes if (mcopy) { 222df8bae1dSRodney W. Grimes eh = mtod(mcopy, struct ether_header *); 223df8bae1dSRodney W. Grimes bcopy((caddr_t)edst, 224df8bae1dSRodney W. Grimes (caddr_t)eh->ether_dhost, sizeof (edst)); 225df8bae1dSRodney W. Grimes bcopy((caddr_t)ac->ac_enaddr, 226df8bae1dSRodney W. Grimes (caddr_t)eh->ether_shost, sizeof (edst)); 227df8bae1dSRodney W. Grimes } 228df8bae1dSRodney W. Grimes } 229df8bae1dSRodney W. Grimes type = m->m_pkthdr.len; 230df8bae1dSRodney W. Grimes #ifdef LLC_DEBUG 231df8bae1dSRodney W. Grimes { 232df8bae1dSRodney W. Grimes int i; 233df8bae1dSRodney W. Grimes register struct llc *l = mtod(m, struct llc *); 234df8bae1dSRodney W. Grimes 235df8bae1dSRodney W. Grimes printf("ether_output: sending LLC2 pkt to: "); 236df8bae1dSRodney W. Grimes for (i=0; i<6; i++) 237df8bae1dSRodney W. Grimes printf("%x ", edst[i] & 0xff); 238df8bae1dSRodney W. Grimes printf(" len 0x%x dsap 0x%x ssap 0x%x control 0x%x\n", 239df8bae1dSRodney W. Grimes type & 0xff, l->llc_dsap & 0xff, l->llc_ssap &0xff, 240df8bae1dSRodney W. Grimes l->llc_control & 0xff); 241df8bae1dSRodney W. Grimes 242df8bae1dSRodney W. Grimes } 243df8bae1dSRodney W. Grimes #endif /* LLC_DEBUG */ 244df8bae1dSRodney W. Grimes } break; 245df8bae1dSRodney W. Grimes #endif /* LLC */ 246df8bae1dSRodney W. Grimes 247df8bae1dSRodney W. Grimes case AF_UNSPEC: 248df8bae1dSRodney W. Grimes eh = (struct ether_header *)dst->sa_data; 249df8bae1dSRodney W. Grimes bcopy((caddr_t)eh->ether_dhost, (caddr_t)edst, sizeof (edst)); 250df8bae1dSRodney W. Grimes type = eh->ether_type; 251df8bae1dSRodney W. Grimes break; 252df8bae1dSRodney W. Grimes 253df8bae1dSRodney W. Grimes default: 254df8bae1dSRodney W. Grimes printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit, 255df8bae1dSRodney W. Grimes dst->sa_family); 256df8bae1dSRodney W. Grimes senderr(EAFNOSUPPORT); 257df8bae1dSRodney W. Grimes } 258df8bae1dSRodney W. Grimes 259df8bae1dSRodney W. Grimes 260df8bae1dSRodney W. Grimes if (mcopy) 261df8bae1dSRodney W. Grimes (void) looutput(ifp, mcopy, dst, rt); 262df8bae1dSRodney W. Grimes /* 263df8bae1dSRodney W. Grimes * Add local net header. If no space in first mbuf, 264df8bae1dSRodney W. Grimes * allocate another. 265df8bae1dSRodney W. Grimes */ 266df8bae1dSRodney W. Grimes M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT); 267df8bae1dSRodney W. Grimes if (m == 0) 268df8bae1dSRodney W. Grimes senderr(ENOBUFS); 269df8bae1dSRodney W. Grimes eh = mtod(m, struct ether_header *); 270df8bae1dSRodney W. Grimes type = htons((u_short)type); 271df8bae1dSRodney W. Grimes bcopy((caddr_t)&type,(caddr_t)&eh->ether_type, 272df8bae1dSRodney W. Grimes sizeof(eh->ether_type)); 273df8bae1dSRodney W. Grimes bcopy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst)); 274df8bae1dSRodney W. Grimes bcopy((caddr_t)ac->ac_enaddr, (caddr_t)eh->ether_shost, 275df8bae1dSRodney W. Grimes sizeof(eh->ether_shost)); 276df8bae1dSRodney W. Grimes s = splimp(); 277df8bae1dSRodney W. Grimes /* 278df8bae1dSRodney W. Grimes * Queue message on interface, and start output if interface 279df8bae1dSRodney W. Grimes * not yet active. 280df8bae1dSRodney W. Grimes */ 281df8bae1dSRodney W. Grimes if (IF_QFULL(&ifp->if_snd)) { 282df8bae1dSRodney W. Grimes IF_DROP(&ifp->if_snd); 283df8bae1dSRodney W. Grimes splx(s); 284df8bae1dSRodney W. Grimes senderr(ENOBUFS); 285df8bae1dSRodney W. Grimes } 286df8bae1dSRodney W. Grimes IF_ENQUEUE(&ifp->if_snd, m); 287df8bae1dSRodney W. Grimes if ((ifp->if_flags & IFF_OACTIVE) == 0) 288df8bae1dSRodney W. Grimes (*ifp->if_start)(ifp); 289df8bae1dSRodney W. Grimes splx(s); 290df8bae1dSRodney W. Grimes ifp->if_obytes += len + sizeof (struct ether_header); 291df8bae1dSRodney W. Grimes if (m->m_flags & M_MCAST) 292df8bae1dSRodney W. Grimes ifp->if_omcasts++; 293df8bae1dSRodney W. Grimes return (error); 294df8bae1dSRodney W. Grimes 295df8bae1dSRodney W. Grimes bad: 296df8bae1dSRodney W. Grimes if (m) 297df8bae1dSRodney W. Grimes m_freem(m); 298df8bae1dSRodney W. Grimes return (error); 299df8bae1dSRodney W. Grimes } 300df8bae1dSRodney W. Grimes 301df8bae1dSRodney W. Grimes /* 302df8bae1dSRodney W. Grimes * Process a received Ethernet packet; 303df8bae1dSRodney W. Grimes * the packet is in the mbuf chain m without 304df8bae1dSRodney W. Grimes * the ether header, which is provided separately. 305df8bae1dSRodney W. Grimes */ 306df8bae1dSRodney W. Grimes void 307df8bae1dSRodney W. Grimes ether_input(ifp, eh, m) 308df8bae1dSRodney W. Grimes struct ifnet *ifp; 309df8bae1dSRodney W. Grimes register struct ether_header *eh; 310df8bae1dSRodney W. Grimes struct mbuf *m; 311df8bae1dSRodney W. Grimes { 312df8bae1dSRodney W. Grimes register struct ifqueue *inq; 313df8bae1dSRodney W. Grimes register struct llc *l; 314df8bae1dSRodney W. Grimes struct arpcom *ac = (struct arpcom *)ifp; 315307d80beSDavid Greenman u_short ether_type; 316df8bae1dSRodney W. Grimes int s; 317df8bae1dSRodney W. Grimes 318df8bae1dSRodney W. Grimes if ((ifp->if_flags & IFF_UP) == 0) { 319df8bae1dSRodney W. Grimes m_freem(m); 320df8bae1dSRodney W. Grimes return; 321df8bae1dSRodney W. Grimes } 322df8bae1dSRodney W. Grimes ifp->if_lastchange = time; 323df8bae1dSRodney W. Grimes ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); 324df8bae1dSRodney W. Grimes if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost, 325df8bae1dSRodney W. Grimes sizeof(etherbroadcastaddr)) == 0) 326df8bae1dSRodney W. Grimes m->m_flags |= M_BCAST; 327df8bae1dSRodney W. Grimes else if (eh->ether_dhost[0] & 1) 328df8bae1dSRodney W. Grimes m->m_flags |= M_MCAST; 329df8bae1dSRodney W. Grimes if (m->m_flags & (M_BCAST|M_MCAST)) 330df8bae1dSRodney W. Grimes ifp->if_imcasts++; 331df8bae1dSRodney W. Grimes 332307d80beSDavid Greenman ether_type = ntohs(eh->ether_type); 333307d80beSDavid Greenman 334307d80beSDavid Greenman switch (ether_type) { 335df8bae1dSRodney W. Grimes #ifdef INET 336df8bae1dSRodney W. Grimes case ETHERTYPE_IP: 337df8bae1dSRodney W. Grimes schednetisr(NETISR_IP); 338df8bae1dSRodney W. Grimes inq = &ipintrq; 339df8bae1dSRodney W. Grimes break; 340df8bae1dSRodney W. Grimes 341df8bae1dSRodney W. Grimes case ETHERTYPE_ARP: 342df8bae1dSRodney W. Grimes schednetisr(NETISR_ARP); 343df8bae1dSRodney W. Grimes inq = &arpintrq; 344df8bae1dSRodney W. Grimes break; 345df8bae1dSRodney W. Grimes #endif 346df8bae1dSRodney W. Grimes #ifdef NS 347df8bae1dSRodney W. Grimes case ETHERTYPE_NS: 348df8bae1dSRodney W. Grimes schednetisr(NETISR_NS); 349df8bae1dSRodney W. Grimes inq = &nsintrq; 350df8bae1dSRodney W. Grimes break; 351df8bae1dSRodney W. Grimes 352df8bae1dSRodney W. Grimes #endif 353df8bae1dSRodney W. Grimes default: 354df8bae1dSRodney W. Grimes #if defined (ISO) || defined (LLC) 355307d80beSDavid Greenman if (ether_type > ETHERMTU) 356df8bae1dSRodney W. Grimes goto dropanyway; 357df8bae1dSRodney W. Grimes l = mtod(m, struct llc *); 358df8bae1dSRodney W. Grimes switch (l->llc_dsap) { 359df8bae1dSRodney W. Grimes #ifdef ISO 360df8bae1dSRodney W. Grimes case LLC_ISO_LSAP: 361df8bae1dSRodney W. Grimes switch (l->llc_control) { 362df8bae1dSRodney W. Grimes case LLC_UI: 363df8bae1dSRodney W. Grimes /* LLC_UI_P forbidden in class 1 service */ 364df8bae1dSRodney W. Grimes if ((l->llc_dsap == LLC_ISO_LSAP) && 365df8bae1dSRodney W. Grimes (l->llc_ssap == LLC_ISO_LSAP)) { 366df8bae1dSRodney W. Grimes /* LSAP for ISO */ 367307d80beSDavid Greenman if (m->m_pkthdr.len > ether_type) 368307d80beSDavid Greenman m_adj(m, ether_type - m->m_pkthdr.len); 369df8bae1dSRodney W. Grimes m->m_data += 3; /* XXX */ 370df8bae1dSRodney W. Grimes m->m_len -= 3; /* XXX */ 371df8bae1dSRodney W. Grimes m->m_pkthdr.len -= 3; /* XXX */ 372df8bae1dSRodney W. Grimes M_PREPEND(m, sizeof *eh, M_DONTWAIT); 373df8bae1dSRodney W. Grimes if (m == 0) 374df8bae1dSRodney W. Grimes return; 375df8bae1dSRodney W. Grimes *mtod(m, struct ether_header *) = *eh; 376df8bae1dSRodney W. Grimes IFDEBUG(D_ETHER) 377df8bae1dSRodney W. Grimes printf("clnp packet"); 378df8bae1dSRodney W. Grimes ENDDEBUG 379df8bae1dSRodney W. Grimes schednetisr(NETISR_ISO); 380df8bae1dSRodney W. Grimes inq = &clnlintrq; 381df8bae1dSRodney W. Grimes break; 382df8bae1dSRodney W. Grimes } 383df8bae1dSRodney W. Grimes goto dropanyway; 384df8bae1dSRodney W. Grimes 385df8bae1dSRodney W. Grimes case LLC_XID: 386df8bae1dSRodney W. Grimes case LLC_XID_P: 387df8bae1dSRodney W. Grimes if(m->m_len < 6) 388df8bae1dSRodney W. Grimes goto dropanyway; 389df8bae1dSRodney W. Grimes l->llc_window = 0; 390df8bae1dSRodney W. Grimes l->llc_fid = 9; 391df8bae1dSRodney W. Grimes l->llc_class = 1; 392df8bae1dSRodney W. Grimes l->llc_dsap = l->llc_ssap = 0; 393df8bae1dSRodney W. Grimes /* Fall through to */ 394df8bae1dSRodney W. Grimes case LLC_TEST: 395df8bae1dSRodney W. Grimes case LLC_TEST_P: 396df8bae1dSRodney W. Grimes { 397df8bae1dSRodney W. Grimes struct sockaddr sa; 398df8bae1dSRodney W. Grimes register struct ether_header *eh2; 399df8bae1dSRodney W. Grimes int i; 400df8bae1dSRodney W. Grimes u_char c = l->llc_dsap; 401df8bae1dSRodney W. Grimes 402df8bae1dSRodney W. Grimes l->llc_dsap = l->llc_ssap; 403df8bae1dSRodney W. Grimes l->llc_ssap = c; 404df8bae1dSRodney W. Grimes if (m->m_flags & (M_BCAST | M_MCAST)) 405df8bae1dSRodney W. Grimes bcopy((caddr_t)ac->ac_enaddr, 406df8bae1dSRodney W. Grimes (caddr_t)eh->ether_dhost, 6); 407df8bae1dSRodney W. Grimes sa.sa_family = AF_UNSPEC; 408df8bae1dSRodney W. Grimes sa.sa_len = sizeof(sa); 409df8bae1dSRodney W. Grimes eh2 = (struct ether_header *)sa.sa_data; 410df8bae1dSRodney W. Grimes for (i = 0; i < 6; i++) { 411df8bae1dSRodney W. Grimes eh2->ether_shost[i] = c = eh->ether_dhost[i]; 412df8bae1dSRodney W. Grimes eh2->ether_dhost[i] = 413df8bae1dSRodney W. Grimes eh->ether_dhost[i] = eh->ether_shost[i]; 414df8bae1dSRodney W. Grimes eh->ether_shost[i] = c; 415df8bae1dSRodney W. Grimes } 416df8bae1dSRodney W. Grimes ifp->if_output(ifp, m, &sa, NULL); 417df8bae1dSRodney W. Grimes return; 418df8bae1dSRodney W. Grimes } 419df8bae1dSRodney W. Grimes default: 420df8bae1dSRodney W. Grimes m_freem(m); 421df8bae1dSRodney W. Grimes return; 422df8bae1dSRodney W. Grimes } 423df8bae1dSRodney W. Grimes break; 424df8bae1dSRodney W. Grimes #endif /* ISO */ 425df8bae1dSRodney W. Grimes #ifdef LLC 426df8bae1dSRodney W. Grimes case LLC_X25_LSAP: 427df8bae1dSRodney W. Grimes { 428307d80beSDavid Greenman if (m->m_pkthdr.len > ether_type) 429307d80beSDavid Greenman m_adj(m, ether_type - m->m_pkthdr.len); 430df8bae1dSRodney W. Grimes M_PREPEND(m, sizeof(struct sdl_hdr) , M_DONTWAIT); 431df8bae1dSRodney W. Grimes if (m == 0) 432df8bae1dSRodney W. Grimes return; 433df8bae1dSRodney W. Grimes if ( !sdl_sethdrif(ifp, eh->ether_shost, LLC_X25_LSAP, 434df8bae1dSRodney W. Grimes eh->ether_dhost, LLC_X25_LSAP, 6, 435df8bae1dSRodney W. Grimes mtod(m, struct sdl_hdr *))) 436df8bae1dSRodney W. Grimes panic("ETHER cons addr failure"); 437307d80beSDavid Greenman mtod(m, struct sdl_hdr *)->sdlhdr_len = ether_type; 438df8bae1dSRodney W. Grimes #ifdef LLC_DEBUG 439df8bae1dSRodney W. Grimes printf("llc packet\n"); 440df8bae1dSRodney W. Grimes #endif /* LLC_DEBUG */ 441df8bae1dSRodney W. Grimes schednetisr(NETISR_CCITT); 442df8bae1dSRodney W. Grimes inq = &llcintrq; 443df8bae1dSRodney W. Grimes break; 444df8bae1dSRodney W. Grimes } 445df8bae1dSRodney W. Grimes #endif /* LLC */ 446df8bae1dSRodney W. Grimes dropanyway: 447df8bae1dSRodney W. Grimes default: 448df8bae1dSRodney W. Grimes m_freem(m); 449df8bae1dSRodney W. Grimes return; 450df8bae1dSRodney W. Grimes } 451df8bae1dSRodney W. Grimes #else /* ISO || LLC */ 452df8bae1dSRodney W. Grimes m_freem(m); 453df8bae1dSRodney W. Grimes return; 454df8bae1dSRodney W. Grimes #endif /* ISO || LLC */ 455df8bae1dSRodney W. Grimes } 456df8bae1dSRodney W. Grimes 457df8bae1dSRodney W. Grimes s = splimp(); 458df8bae1dSRodney W. Grimes if (IF_QFULL(inq)) { 459df8bae1dSRodney W. Grimes IF_DROP(inq); 460df8bae1dSRodney W. Grimes m_freem(m); 461df8bae1dSRodney W. Grimes } else 462df8bae1dSRodney W. Grimes IF_ENQUEUE(inq, m); 463df8bae1dSRodney W. Grimes splx(s); 464df8bae1dSRodney W. Grimes } 465df8bae1dSRodney W. Grimes 466df8bae1dSRodney W. Grimes /* 467df8bae1dSRodney W. Grimes * Convert Ethernet address to printable (loggable) representation. 468df8bae1dSRodney W. Grimes */ 469df8bae1dSRodney W. Grimes static char digits[] = "0123456789abcdef"; 470df8bae1dSRodney W. Grimes char * 471df8bae1dSRodney W. Grimes ether_sprintf(ap) 472df8bae1dSRodney W. Grimes register u_char *ap; 473df8bae1dSRodney W. Grimes { 474df8bae1dSRodney W. Grimes register i; 475df8bae1dSRodney W. Grimes static char etherbuf[18]; 476df8bae1dSRodney W. Grimes register char *cp = etherbuf; 477df8bae1dSRodney W. Grimes 478df8bae1dSRodney W. Grimes for (i = 0; i < 6; i++) { 479df8bae1dSRodney W. Grimes *cp++ = digits[*ap >> 4]; 480df8bae1dSRodney W. Grimes *cp++ = digits[*ap++ & 0xf]; 481df8bae1dSRodney W. Grimes *cp++ = ':'; 482df8bae1dSRodney W. Grimes } 483df8bae1dSRodney W. Grimes *--cp = 0; 484df8bae1dSRodney W. Grimes return (etherbuf); 485df8bae1dSRodney W. Grimes } 486df8bae1dSRodney W. Grimes 487df8bae1dSRodney W. Grimes /* 488df8bae1dSRodney W. Grimes * Perform common duties while attaching to interface list 489df8bae1dSRodney W. Grimes */ 490df8bae1dSRodney W. Grimes void 491df8bae1dSRodney W. Grimes ether_ifattach(ifp) 492df8bae1dSRodney W. Grimes register struct ifnet *ifp; 493df8bae1dSRodney W. Grimes { 494df8bae1dSRodney W. Grimes register struct ifaddr *ifa; 495df8bae1dSRodney W. Grimes register struct sockaddr_dl *sdl; 496df8bae1dSRodney W. Grimes 497df8bae1dSRodney W. Grimes ifp->if_type = IFT_ETHER; 498df8bae1dSRodney W. Grimes ifp->if_addrlen = 6; 499df8bae1dSRodney W. Grimes ifp->if_hdrlen = 14; 500df8bae1dSRodney W. Grimes ifp->if_mtu = ETHERMTU; 501df8bae1dSRodney W. Grimes for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) 502df8bae1dSRodney W. Grimes if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && 503df8bae1dSRodney W. Grimes sdl->sdl_family == AF_LINK) { 504df8bae1dSRodney W. Grimes sdl->sdl_type = IFT_ETHER; 505df8bae1dSRodney W. Grimes sdl->sdl_alen = ifp->if_addrlen; 506df8bae1dSRodney W. Grimes bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, 507df8bae1dSRodney W. Grimes LLADDR(sdl), ifp->if_addrlen); 508df8bae1dSRodney W. Grimes break; 509df8bae1dSRodney W. Grimes } 510df8bae1dSRodney W. Grimes } 511df8bae1dSRodney W. Grimes 512df8bae1dSRodney W. Grimes u_char ether_ipmulticast_min[6] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 }; 513df8bae1dSRodney W. Grimes u_char ether_ipmulticast_max[6] = { 0x01, 0x00, 0x5e, 0x7f, 0xff, 0xff }; 514df8bae1dSRodney W. Grimes /* 515df8bae1dSRodney W. Grimes * Add an Ethernet multicast address or range of addresses to the list for a 516df8bae1dSRodney W. Grimes * given interface. 517df8bae1dSRodney W. Grimes */ 518df8bae1dSRodney W. Grimes int 519df8bae1dSRodney W. Grimes ether_addmulti(ifr, ac) 520df8bae1dSRodney W. Grimes struct ifreq *ifr; 521df8bae1dSRodney W. Grimes register struct arpcom *ac; 522df8bae1dSRodney W. Grimes { 523df8bae1dSRodney W. Grimes register struct ether_multi *enm; 524df8bae1dSRodney W. Grimes struct sockaddr_in *sin; 525df8bae1dSRodney W. Grimes u_char addrlo[6]; 526df8bae1dSRodney W. Grimes u_char addrhi[6]; 527df8bae1dSRodney W. Grimes int s = splimp(); 528df8bae1dSRodney W. Grimes 529df8bae1dSRodney W. Grimes switch (ifr->ifr_addr.sa_family) { 530df8bae1dSRodney W. Grimes 531df8bae1dSRodney W. Grimes case AF_UNSPEC: 532df8bae1dSRodney W. Grimes bcopy(ifr->ifr_addr.sa_data, addrlo, 6); 533df8bae1dSRodney W. Grimes bcopy(addrlo, addrhi, 6); 534df8bae1dSRodney W. Grimes break; 535df8bae1dSRodney W. Grimes 536df8bae1dSRodney W. Grimes #ifdef INET 537df8bae1dSRodney W. Grimes case AF_INET: 538df8bae1dSRodney W. Grimes sin = (struct sockaddr_in *)&(ifr->ifr_addr); 539df8bae1dSRodney W. Grimes if (sin->sin_addr.s_addr == INADDR_ANY) { 540df8bae1dSRodney W. Grimes /* 541df8bae1dSRodney W. Grimes * An IP address of INADDR_ANY means listen to all 542df8bae1dSRodney W. Grimes * of the Ethernet multicast addresses used for IP. 543df8bae1dSRodney W. Grimes * (This is for the sake of IP multicast routers.) 544df8bae1dSRodney W. Grimes */ 545df8bae1dSRodney W. Grimes bcopy(ether_ipmulticast_min, addrlo, 6); 546df8bae1dSRodney W. Grimes bcopy(ether_ipmulticast_max, addrhi, 6); 547df8bae1dSRodney W. Grimes } 548df8bae1dSRodney W. Grimes else { 549df8bae1dSRodney W. Grimes ETHER_MAP_IP_MULTICAST(&sin->sin_addr, addrlo); 550df8bae1dSRodney W. Grimes bcopy(addrlo, addrhi, 6); 551df8bae1dSRodney W. Grimes } 552df8bae1dSRodney W. Grimes break; 553df8bae1dSRodney W. Grimes #endif 554df8bae1dSRodney W. Grimes 555df8bae1dSRodney W. Grimes default: 556df8bae1dSRodney W. Grimes splx(s); 557df8bae1dSRodney W. Grimes return (EAFNOSUPPORT); 558df8bae1dSRodney W. Grimes } 559df8bae1dSRodney W. Grimes 560df8bae1dSRodney W. Grimes /* 561df8bae1dSRodney W. Grimes * Verify that we have valid Ethernet multicast addresses. 562df8bae1dSRodney W. Grimes */ 563df8bae1dSRodney W. Grimes if ((addrlo[0] & 0x01) != 1 || (addrhi[0] & 0x01) != 1) { 564df8bae1dSRodney W. Grimes splx(s); 565df8bae1dSRodney W. Grimes return (EINVAL); 566df8bae1dSRodney W. Grimes } 567df8bae1dSRodney W. Grimes /* 568df8bae1dSRodney W. Grimes * See if the address range is already in the list. 569df8bae1dSRodney W. Grimes */ 570df8bae1dSRodney W. Grimes ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm); 571df8bae1dSRodney W. Grimes if (enm != NULL) { 572df8bae1dSRodney W. Grimes /* 573df8bae1dSRodney W. Grimes * Found it; just increment the reference count. 574df8bae1dSRodney W. Grimes */ 575df8bae1dSRodney W. Grimes ++enm->enm_refcount; 576df8bae1dSRodney W. Grimes splx(s); 577df8bae1dSRodney W. Grimes return (0); 578df8bae1dSRodney W. Grimes } 579df8bae1dSRodney W. Grimes /* 580df8bae1dSRodney W. Grimes * New address or range; malloc a new multicast record 581df8bae1dSRodney W. Grimes * and link it into the interface's multicast list. 582df8bae1dSRodney W. Grimes */ 583df8bae1dSRodney W. Grimes enm = (struct ether_multi *)malloc(sizeof(*enm), M_IFMADDR, M_NOWAIT); 584df8bae1dSRodney W. Grimes if (enm == NULL) { 585df8bae1dSRodney W. Grimes splx(s); 586df8bae1dSRodney W. Grimes return (ENOBUFS); 587df8bae1dSRodney W. Grimes } 588df8bae1dSRodney W. Grimes bcopy(addrlo, enm->enm_addrlo, 6); 589df8bae1dSRodney W. Grimes bcopy(addrhi, enm->enm_addrhi, 6); 590df8bae1dSRodney W. Grimes enm->enm_ac = ac; 591df8bae1dSRodney W. Grimes enm->enm_refcount = 1; 592df8bae1dSRodney W. Grimes enm->enm_next = ac->ac_multiaddrs; 593df8bae1dSRodney W. Grimes ac->ac_multiaddrs = enm; 594df8bae1dSRodney W. Grimes ac->ac_multicnt++; 595df8bae1dSRodney W. Grimes splx(s); 596df8bae1dSRodney W. Grimes /* 597df8bae1dSRodney W. Grimes * Return ENETRESET to inform the driver that the list has changed 598df8bae1dSRodney W. Grimes * and its reception filter should be adjusted accordingly. 599df8bae1dSRodney W. Grimes */ 600df8bae1dSRodney W. Grimes return (ENETRESET); 601df8bae1dSRodney W. Grimes } 602df8bae1dSRodney W. Grimes 603df8bae1dSRodney W. Grimes /* 604df8bae1dSRodney W. Grimes * Delete a multicast address record. 605df8bae1dSRodney W. Grimes */ 606df8bae1dSRodney W. Grimes int 607df8bae1dSRodney W. Grimes ether_delmulti(ifr, ac) 608df8bae1dSRodney W. Grimes struct ifreq *ifr; 609df8bae1dSRodney W. Grimes register struct arpcom *ac; 610df8bae1dSRodney W. Grimes { 611df8bae1dSRodney W. Grimes register struct ether_multi *enm; 612df8bae1dSRodney W. Grimes register struct ether_multi **p; 613df8bae1dSRodney W. Grimes struct sockaddr_in *sin; 614df8bae1dSRodney W. Grimes u_char addrlo[6]; 615df8bae1dSRodney W. Grimes u_char addrhi[6]; 616df8bae1dSRodney W. Grimes int s = splimp(); 617df8bae1dSRodney W. Grimes 618df8bae1dSRodney W. Grimes switch (ifr->ifr_addr.sa_family) { 619df8bae1dSRodney W. Grimes 620df8bae1dSRodney W. Grimes case AF_UNSPEC: 621df8bae1dSRodney W. Grimes bcopy(ifr->ifr_addr.sa_data, addrlo, 6); 622df8bae1dSRodney W. Grimes bcopy(addrlo, addrhi, 6); 623df8bae1dSRodney W. Grimes break; 624df8bae1dSRodney W. Grimes 625df8bae1dSRodney W. Grimes #ifdef INET 626df8bae1dSRodney W. Grimes case AF_INET: 627df8bae1dSRodney W. Grimes sin = (struct sockaddr_in *)&(ifr->ifr_addr); 628df8bae1dSRodney W. Grimes if (sin->sin_addr.s_addr == INADDR_ANY) { 629df8bae1dSRodney W. Grimes /* 630df8bae1dSRodney W. Grimes * An IP address of INADDR_ANY means stop listening 631df8bae1dSRodney W. Grimes * to the range of Ethernet multicast addresses used 632df8bae1dSRodney W. Grimes * for IP. 633df8bae1dSRodney W. Grimes */ 634df8bae1dSRodney W. Grimes bcopy(ether_ipmulticast_min, addrlo, 6); 635df8bae1dSRodney W. Grimes bcopy(ether_ipmulticast_max, addrhi, 6); 636df8bae1dSRodney W. Grimes } 637df8bae1dSRodney W. Grimes else { 638df8bae1dSRodney W. Grimes ETHER_MAP_IP_MULTICAST(&sin->sin_addr, addrlo); 639df8bae1dSRodney W. Grimes bcopy(addrlo, addrhi, 6); 640df8bae1dSRodney W. Grimes } 641df8bae1dSRodney W. Grimes break; 642df8bae1dSRodney W. Grimes #endif 643df8bae1dSRodney W. Grimes 644df8bae1dSRodney W. Grimes default: 645df8bae1dSRodney W. Grimes splx(s); 646df8bae1dSRodney W. Grimes return (EAFNOSUPPORT); 647df8bae1dSRodney W. Grimes } 648df8bae1dSRodney W. Grimes 649df8bae1dSRodney W. Grimes /* 650df8bae1dSRodney W. Grimes * Look up the address in our list. 651df8bae1dSRodney W. Grimes */ 652df8bae1dSRodney W. Grimes ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm); 653df8bae1dSRodney W. Grimes if (enm == NULL) { 654df8bae1dSRodney W. Grimes splx(s); 655df8bae1dSRodney W. Grimes return (ENXIO); 656df8bae1dSRodney W. Grimes } 657df8bae1dSRodney W. Grimes if (--enm->enm_refcount != 0) { 658df8bae1dSRodney W. Grimes /* 659df8bae1dSRodney W. Grimes * Still some claims to this record. 660df8bae1dSRodney W. Grimes */ 661df8bae1dSRodney W. Grimes splx(s); 662df8bae1dSRodney W. Grimes return (0); 663df8bae1dSRodney W. Grimes } 664df8bae1dSRodney W. Grimes /* 665df8bae1dSRodney W. Grimes * No remaining claims to this record; unlink and free it. 666df8bae1dSRodney W. Grimes */ 667df8bae1dSRodney W. Grimes for (p = &enm->enm_ac->ac_multiaddrs; 668df8bae1dSRodney W. Grimes *p != enm; 669df8bae1dSRodney W. Grimes p = &(*p)->enm_next) 670df8bae1dSRodney W. Grimes continue; 671df8bae1dSRodney W. Grimes *p = (*p)->enm_next; 672df8bae1dSRodney W. Grimes free(enm, M_IFMADDR); 673df8bae1dSRodney W. Grimes ac->ac_multicnt--; 674df8bae1dSRodney W. Grimes splx(s); 675df8bae1dSRodney W. Grimes /* 676df8bae1dSRodney W. Grimes * Return ENETRESET to inform the driver that the list has changed 677df8bae1dSRodney W. Grimes * and its reception filter should be adjusted accordingly. 678df8bae1dSRodney W. Grimes */ 679df8bae1dSRodney W. Grimes return (ENETRESET); 680df8bae1dSRodney W. Grimes } 681