]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/ether_if_module.c
xnu-6153.61.1.tar.gz
[apple/xnu.git] / bsd / net / ether_if_module.c
1 /*
2 * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * Copyright (c) 1982, 1989, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 */
61
62 #include <sys/param.h>
63 #include <sys/systm.h>
64 #include <sys/kernel.h>
65 #include <sys/malloc.h>
66 #include <sys/mbuf.h>
67 #include <sys/socket.h>
68 #include <sys/sockio.h>
69 #include <sys/sysctl.h>
70
71 #include <pexpert/pexpert.h>
72
73 #define etherbroadcastaddr fugly
74 #include <net/if.h>
75 #include <net/route.h>
76 #include <net/if_llc.h>
77 #include <net/if_dl.h>
78 #include <net/if_types.h>
79 #include <net/if_ether.h>
80 #include <net/if_gif.h>
81 #include <netinet/if_ether.h>
82 #include <netinet/in.h> /* For M_LOOP */
83 #include <net/kpi_interface.h>
84 #include <net/kpi_protocol.h>
85 #undef etherbroadcastaddr
86
87 /*
88 #if INET
89 #include <netinet/in.h>
90 #include <netinet/in_var.h>
91 *
92 #include <netinet/in_systm.h>
93 #include <netinet/ip.h>
94 #endif
95 */
96 #include <net/ether_if_module.h>
97 #include <sys/socketvar.h>
98 #include <net/if_vlan_var.h>
99 #include <net/if_6lowpan_var.h>
100 #if BOND
101 #include <net/if_bond_internal.h>
102 #endif /* BOND */
103 #if IF_BRIDGE
104 #include <net/if_bridgevar.h>
105 #endif /* IF_BRIDGE */
106 #if IF_FAKE
107 #include <net/if_fake_var.h>
108 #endif /* IF_FAKE */
109 #if IF_HEADLESS
110 extern void if_headless_init(void);
111 #endif /* IF_HEADLESS */
112
113 #include <net/dlil.h>
114
115 SYSCTL_DECL(_net_link);
116 SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW | CTLFLAG_LOCKED, 0,
117 "Ethernet");
118
119 struct en_desc {
120 u_int16_t type; /* Type of protocol stored in data */
121 u_int32_t protocol_family; /* Protocol family */
122 u_int32_t data[2]; /* Protocol data */
123 };
124
125 /* descriptors are allocated in blocks of ETHER_DESC_BLK_SIZE */
126 #if CONFIG_EMBEDDED
127 #define ETHER_DESC_BLK_SIZE (2) /* IP, ARP */
128 #else
129 #define ETHER_DESC_BLK_SIZE (10)
130 #endif
131
132 /*
133 * Header for the demux list, hangs off of IFP at if_family_cookie
134 */
135 struct ether_desc_blk_str {
136 u_int32_t n_max_used;
137 u_int32_t n_count;
138 u_int32_t n_used;
139 struct en_desc block_ptr[1];
140 };
141
142 /* Size of the above struct before the array of struct en_desc */
143 #define ETHER_DESC_HEADER_SIZE \
144 ((size_t) offsetof(struct ether_desc_blk_str, block_ptr))
145
146 __private_extern__ u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
147 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
148
149 /*
150 * Release all descriptor entries owned by this protocol (there may be several).
151 * Setting the type to 0 releases the entry. Eventually we should compact-out
152 * the unused entries.
153 */
154 int
155 ether_del_proto(ifnet_t ifp, protocol_family_t protocol_family)
156 {
157 struct ether_desc_blk_str *desc_blk =
158 (struct ether_desc_blk_str *)ifp->if_family_cookie;
159 u_int32_t current = 0;
160 int found = 0;
161
162 if (desc_blk == NULL) {
163 return 0;
164 }
165
166 for (current = desc_blk->n_max_used; current > 0; current--) {
167 if (desc_blk->block_ptr[current - 1].protocol_family ==
168 protocol_family) {
169 found = 1;
170 desc_blk->block_ptr[current - 1].type = 0;
171 desc_blk->n_used--;
172 }
173 }
174
175 if (desc_blk->n_used == 0) {
176 FREE(ifp->if_family_cookie, M_IFADDR);
177 ifp->if_family_cookie = 0;
178 } else {
179 /* Decrement n_max_used */
180 for (; desc_blk->n_max_used > 0 &&
181 desc_blk->block_ptr[desc_blk->n_max_used - 1].type == 0;
182 desc_blk->n_max_used--) {
183 ;
184 }
185 }
186
187 return 0;
188 }
189
190 static int
191 ether_add_proto_internal(struct ifnet *ifp, protocol_family_t protocol,
192 const struct ifnet_demux_desc *demux)
193 {
194 struct en_desc *ed;
195 struct ether_desc_blk_str *desc_blk =
196 (struct ether_desc_blk_str *)ifp->if_family_cookie;
197 u_int32_t i;
198
199 switch (demux->type) {
200 /* These types are supported */
201 /* Top three are preferred */
202 case DLIL_DESC_ETYPE2:
203 if (demux->datalen != 2) {
204 return EINVAL;
205 }
206 break;
207
208 case DLIL_DESC_SAP:
209 if (demux->datalen != 3) {
210 return EINVAL;
211 }
212 break;
213
214 case DLIL_DESC_SNAP:
215 if (demux->datalen != 5) {
216 return EINVAL;
217 }
218 break;
219
220 default:
221 return ENOTSUP;
222 }
223
224 /* Verify a matching descriptor does not exist */
225 if (desc_blk != NULL) {
226 switch (demux->type) {
227 case DLIL_DESC_ETYPE2:
228 for (i = 0; i < desc_blk->n_max_used; i++) {
229 if (desc_blk->block_ptr[i].type ==
230 DLIL_DESC_ETYPE2 &&
231 desc_blk->block_ptr[i].data[0] ==
232 *(u_int16_t*)demux->data) {
233 return EADDRINUSE;
234 }
235 }
236 break;
237 case DLIL_DESC_SAP:
238 case DLIL_DESC_SNAP:
239 for (i = 0; i < desc_blk->n_max_used; i++) {
240 if (desc_blk->block_ptr[i].type ==
241 demux->type &&
242 bcmp(desc_blk->block_ptr[i].data,
243 demux->data, demux->datalen) == 0) {
244 return EADDRINUSE;
245 }
246 }
247 break;
248 }
249 }
250
251 /* Check for case where all of the descriptor blocks are in use */
252 if (desc_blk == NULL || desc_blk->n_used == desc_blk->n_count) {
253 struct ether_desc_blk_str *tmp;
254 u_int32_t new_count = ETHER_DESC_BLK_SIZE;
255 u_int32_t new_size;
256 u_int32_t old_size = 0;
257
258 i = 0;
259
260 if (desc_blk) {
261 new_count += desc_blk->n_count;
262 old_size = desc_blk->n_count * sizeof(struct en_desc) +
263 ETHER_DESC_HEADER_SIZE;
264 i = desc_blk->n_used;
265 }
266
267 new_size = new_count * sizeof(struct en_desc) +
268 ETHER_DESC_HEADER_SIZE;
269
270 tmp = _MALLOC(new_size, M_IFADDR, M_WAITOK);
271 if (tmp == NULL) {
272 /*
273 * Remove any previous descriptors set in the call.
274 */
275 return ENOMEM;
276 }
277
278 bzero(((char *)tmp) + old_size, new_size - old_size);
279 if (desc_blk) {
280 bcopy(desc_blk, tmp, old_size);
281 FREE(desc_blk, M_IFADDR);
282 }
283 desc_blk = tmp;
284 ifp->if_family_cookie = (uintptr_t)desc_blk;
285 desc_blk->n_count = new_count;
286 } else {
287 /* Find a free entry */
288 for (i = 0; i < desc_blk->n_count; i++) {
289 if (desc_blk->block_ptr[i].type == 0) {
290 break;
291 }
292 }
293 }
294
295 /* Bump n_max_used if appropriate */
296 if (i + 1 > desc_blk->n_max_used) {
297 desc_blk->n_max_used = i + 1;
298 }
299
300 ed = &desc_blk->block_ptr[i];
301 ed->protocol_family = protocol;
302 ed->data[0] = 0;
303 ed->data[1] = 0;
304
305 switch (demux->type) {
306 case DLIL_DESC_ETYPE2:
307 /* 2 byte ethernet raw protocol type is at native_type */
308 /* prtocol must be in network byte order */
309 ed->type = DLIL_DESC_ETYPE2;
310 ed->data[0] = *(u_int16_t*)demux->data;
311 break;
312
313 case DLIL_DESC_SAP:
314 ed->type = DLIL_DESC_SAP;
315 bcopy(demux->data, &ed->data[0], 3);
316 break;
317
318 case DLIL_DESC_SNAP: {
319 u_int8_t* pDest = ((u_int8_t*)&ed->data[0]) + 3;
320 ed->type = DLIL_DESC_SNAP;
321 bcopy(demux->data, pDest, 5);
322 break;
323 }
324 }
325
326 desc_blk->n_used++;
327
328 return 0;
329 }
330
331 int
332 ether_add_proto(ifnet_t ifp, protocol_family_t protocol,
333 const struct ifnet_demux_desc *demux_list, u_int32_t demux_count)
334 {
335 int error = 0;
336 u_int32_t i;
337
338 for (i = 0; i < demux_count; i++) {
339 error = ether_add_proto_internal(ifp, protocol, &demux_list[i]);
340 if (error) {
341 ether_del_proto(ifp, protocol);
342 break;
343 }
344 }
345
346 return error;
347 }
348
349 int
350 ether_demux(ifnet_t ifp, mbuf_t m, char *frame_header,
351 protocol_family_t *protocol_family)
352 {
353 struct ether_header *eh = (struct ether_header *)(void *)frame_header;
354 u_short ether_type = eh->ether_type;
355 u_int16_t type;
356 u_int8_t *data;
357 u_int32_t i = 0;
358 struct ether_desc_blk_str *desc_blk =
359 (struct ether_desc_blk_str *)ifp->if_family_cookie;
360 u_int32_t maxd = desc_blk ? desc_blk->n_max_used : 0;
361 struct en_desc *ed = desc_blk ? desc_blk->block_ptr : NULL;
362 u_int32_t extProto1 = 0;
363 u_int32_t extProto2 = 0;
364
365 if (eh->ether_dhost[0] & 1) {
366 /* Check for broadcast */
367 if (_ether_cmp(etherbroadcastaddr, eh->ether_dhost) == 0) {
368 m->m_flags |= M_BCAST;
369 } else {
370 m->m_flags |= M_MCAST;
371 }
372 }
373
374 if (m->m_flags & M_HASFCS) {
375 /*
376 * If the M_HASFCS is set by the driver we want to make sure
377 * that we strip off the trailing FCS data before handing it
378 * up the stack.
379 */
380 m_adj(m, -ETHER_CRC_LEN);
381 m->m_flags &= ~M_HASFCS;
382 }
383
384 if ((eh->ether_dhost[0] & 1) == 0) {
385 /*
386 * When the driver is put into promiscuous mode we may receive
387 * unicast frames that are not intended for our interfaces.
388 * They are marked here as being promiscuous so the caller may
389 * dispose of them after passing the packets to any interface
390 * filters.
391 */
392 if (_ether_cmp(eh->ether_dhost, IF_LLADDR(ifp))) {
393 m->m_flags |= M_PROMISC;
394 }
395 }
396
397 /* check for IEEE 802.15.4 */
398 if (ether_type == htons(ETHERTYPE_IEEE802154)) {
399 *protocol_family = PF_802154;
400 return 0;
401 }
402
403 /* check for VLAN */
404 if ((m->m_pkthdr.csum_flags & CSUM_VLAN_TAG_VALID) != 0) {
405 if (EVL_VLANOFTAG(m->m_pkthdr.vlan_tag) != 0) {
406 *protocol_family = PF_VLAN;
407 return 0;
408 }
409 /* the packet is just priority-tagged, clear the bit */
410 m->m_pkthdr.csum_flags &= ~CSUM_VLAN_TAG_VALID;
411 } else if (ether_type == htons(ETHERTYPE_VLAN)) {
412 struct ether_vlan_header * evl;
413
414 evl = (struct ether_vlan_header *)(void *)frame_header;
415 if (m->m_len < ETHER_VLAN_ENCAP_LEN ||
416 ntohs(evl->evl_proto) == ETHERTYPE_VLAN ||
417 EVL_VLANOFTAG(ntohs(evl->evl_tag)) != 0) {
418 *protocol_family = PF_VLAN;
419 return 0;
420 }
421 /* the packet is just priority-tagged */
422
423 /* make the encapsulated ethertype the actual ethertype */
424 ether_type = evl->evl_encap_proto = evl->evl_proto;
425
426 /* remove the encapsulation header */
427 m->m_len -= ETHER_VLAN_ENCAP_LEN;
428 m->m_data += ETHER_VLAN_ENCAP_LEN;
429 m->m_pkthdr.len -= ETHER_VLAN_ENCAP_LEN;
430 m->m_pkthdr.csum_flags = 0; /* can't trust hardware checksum */
431 } else if (ether_type == htons(ETHERTYPE_ARP)) {
432 m->m_pkthdr.pkt_flags |= PKTF_INET_RESOLVE; /* ARP packet */
433 }
434 data = mtod(m, u_int8_t*);
435
436 /*
437 * Determine the packet's protocol type and stuff the protocol into
438 * longs for quick compares.
439 */
440 if (ntohs(ether_type) <= 1500) {
441 bcopy(data, &extProto1, sizeof(u_int32_t));
442
443 /* SAP or SNAP */
444 if ((extProto1 & htonl(0xFFFFFF00)) == htonl(0xAAAA0300)) {
445 /* SNAP */
446 type = DLIL_DESC_SNAP;
447 bcopy(data + sizeof(u_int32_t), &extProto2,
448 sizeof(u_int32_t));
449 extProto1 &= htonl(0x000000FF);
450 } else {
451 type = DLIL_DESC_SAP;
452 extProto1 &= htonl(0xFFFFFF00);
453 }
454 } else {
455 type = DLIL_DESC_ETYPE2;
456 }
457
458 /*
459 * Search through the connected protocols for a match.
460 */
461 switch (type) {
462 case DLIL_DESC_ETYPE2:
463 for (i = 0; i < maxd; i++) {
464 if ((ed[i].type == type) &&
465 (ed[i].data[0] == ether_type)) {
466 *protocol_family = ed[i].protocol_family;
467 return 0;
468 }
469 }
470 break;
471
472 case DLIL_DESC_SAP:
473 for (i = 0; i < maxd; i++) {
474 if ((ed[i].type == type) &&
475 (ed[i].data[0] == extProto1)) {
476 *protocol_family = ed[i].protocol_family;
477 return 0;
478 }
479 }
480 break;
481
482 case DLIL_DESC_SNAP:
483 for (i = 0; i < maxd; i++) {
484 if ((ed[i].type == type) &&
485 (ed[i].data[0] == extProto1) &&
486 (ed[i].data[1] == extProto2)) {
487 *protocol_family = ed[i].protocol_family;
488 return 0;
489 }
490 }
491 break;
492 }
493
494 return ENOENT;
495 }
496
497 /*
498 * On embedded, ether_frameout is practicaly ether_frameout_extended.
499 * On non-embedded, ether_frameout has long been exposed as a public KPI,
500 * and therefore its signature must remain the same (without the pre- and
501 * postpend length parameters.)
502 */
503 #if KPI_INTERFACE_EMBEDDED
504 int
505 ether_frameout(struct ifnet *ifp, struct mbuf **m,
506 const struct sockaddr *ndest, const char *edst,
507 const char *ether_type, u_int32_t *prepend_len, u_int32_t *postpend_len)
508 #else /* !KPI_INTERFACE_EMBEDDED */
509 int
510 ether_frameout(struct ifnet *ifp, struct mbuf **m,
511 const struct sockaddr *ndest, const char *edst,
512 const char *ether_type)
513 #endif /* KPI_INTERFACE_EMBEDDED */
514 {
515 #if KPI_INTERFACE_EMBEDDED
516 return ether_frameout_extended(ifp, m, ndest, edst, ether_type,
517 prepend_len, postpend_len);
518 #else /* !KPI_INTERFACE_EMBEDDED */
519 return ether_frameout_extended(ifp, m, ndest, edst, ether_type,
520 NULL, NULL);
521 #endif /* !KPI_INTERFACE_EMBEDDED */
522 }
523
524 /*
525 * Ethernet output routine.
526 * Encapsulate a packet of type family for the local net.
527 * Use trailer local net encapsulation if enough data in first
528 * packet leaves a multiple of 512 bytes of data in remainder.
529 */
530 int
531 ether_frameout_extended(struct ifnet *ifp, struct mbuf **m,
532 const struct sockaddr *ndest, const char *edst,
533 const char *ether_type, u_int32_t *prepend_len, u_int32_t *postpend_len)
534 {
535 struct ether_header *eh;
536 int hlen; /* link layer header length */
537
538 hlen = ETHER_HDR_LEN;
539
540 /*
541 * If a simplex interface, and the packet is being sent to our
542 * Ethernet address or a broadcast address, loopback a copy.
543 * XXX To make a simplex device behave exactly like a duplex
544 * device, we should copy in the case of sending to our own
545 * ethernet address (thus letting the original actually appear
546 * on the wire). However, we don't do that here for security
547 * reasons and compatibility with the original behavior.
548 */
549 if ((ifp->if_flags & IFF_SIMPLEX) &&
550 ((*m)->m_flags & M_LOOP) && lo_ifp != NULL) {
551 if ((*m)->m_flags & M_BCAST) {
552 struct mbuf *n = m_copy(*m, 0, (int)M_COPYALL);
553 if (n != NULL) {
554 dlil_output(lo_ifp, ndest->sa_family,
555 n, NULL, ndest, 0, NULL);
556 }
557 } else if (_ether_cmp(edst, IF_LLADDR(ifp)) == 0) {
558 dlil_output(lo_ifp, ndest->sa_family, *m,
559 NULL, ndest, 0, NULL);
560 return EJUSTRETURN;
561 }
562 }
563
564 /*
565 * Add local net header. If no space in first mbuf,
566 * allocate another.
567 */
568 M_PREPEND(*m, sizeof(struct ether_header), M_DONTWAIT, 0);
569 if (*m == NULL) {
570 return EJUSTRETURN;
571 }
572
573 if (prepend_len != NULL) {
574 *prepend_len = sizeof(struct ether_header);
575 }
576 if (postpend_len != NULL) {
577 *postpend_len = 0;
578 }
579
580 eh = mtod(*m, struct ether_header *);
581 (void) memcpy(&eh->ether_type, ether_type, sizeof(eh->ether_type));
582 (void) memcpy(eh->ether_dhost, edst, ETHER_ADDR_LEN);
583 ifnet_lladdr_copy_bytes(ifp, eh->ether_shost, ETHER_ADDR_LEN);
584
585 return 0;
586 }
587
588 errno_t
589 ether_check_multi(ifnet_t ifp, const struct sockaddr *proto_addr)
590 {
591 #pragma unused(ifp)
592 errno_t result = EAFNOSUPPORT;
593 const u_char *e_addr;
594
595 /*
596 * AF_SPEC and AF_LINK don't require translation. We do
597 * want to verify that they specify a valid multicast.
598 */
599 switch (proto_addr->sa_family) {
600 case AF_UNSPEC:
601 e_addr = (const u_char*)&proto_addr->sa_data[0];
602 if ((e_addr[0] & 0x01) != 0x01) {
603 result = EADDRNOTAVAIL;
604 } else {
605 result = 0;
606 }
607 break;
608
609 case AF_LINK:
610 e_addr = CONST_LLADDR((const struct sockaddr_dl*)
611 (uintptr_t)(size_t)proto_addr);
612 if ((e_addr[0] & 0x01) != 0x01) {
613 result = EADDRNOTAVAIL;
614 } else {
615 result = 0;
616 }
617 break;
618 }
619
620 return result;
621 }
622
623 int
624 ether_ioctl(ifnet_t ifp, u_int32_t command, void *data)
625 {
626 #pragma unused(ifp, command, data)
627 return EOPNOTSUPP;
628 }
629
630 __private_extern__ int
631 ether_family_init(void)
632 {
633 errno_t error = 0;
634
635 /* Register protocol registration functions */
636 if ((error = proto_register_plumber(PF_INET, APPLE_IF_FAM_ETHERNET,
637 ether_attach_inet, ether_detach_inet)) != 0) {
638 printf("proto_register_plumber failed for PF_INET error=%d\n",
639 error);
640 goto done;
641 }
642 #if INET6
643 if ((error = proto_register_plumber(PF_INET6, APPLE_IF_FAM_ETHERNET,
644 ether_attach_inet6, ether_detach_inet6)) != 0) {
645 printf("proto_register_plumber failed for PF_INET6 error=%d\n",
646 error);
647 goto done;
648 }
649 #endif /* INET6 */
650 #if VLAN
651 vlan_family_init();
652 #endif /* VLAN */
653 #if BOND
654 bond_family_init();
655 #endif /* BOND */
656 #if IF_BRIDGE
657 bridgeattach(0);
658 #endif /* IF_BRIDGE */
659 #if IF_FAKE
660 if_fake_init();
661 #endif /* IF_FAKE */
662 #if IF_HEADLESS
663 if_headless_init();
664 #endif /* IF_HEADLESS */
665 #if SIXLOWPAN
666 sixlowpan_family_init();
667 #endif /* VLAN */
668 done:
669
670 return error;
671 }