1 /* 2 * Copyright 1998 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all 9 * supporting documentation, and that the name of M.I.T. not be used 10 * in advertising or publicity pertaining to distribution of the 11 * software without specific, written prior permission. M.I.T. makes 12 * no representations about the suitability of this software for any 13 * purpose. It is provided "as is" without express or implied 14 * warranty. 15 * 16 * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS 17 * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 20 * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $FreeBSD$ 30 */ 31 32 /* 33 * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs. 34 * Might be extended some day to also handle IEEE 802.1p priority 35 * tagging. This is sort of sneaky in the implementation, since 36 * we need to pretend to be enough of an Ethernet implementation 37 * to make arp work. The way we do this is by telling everyone 38 * that we are an Ethernet, and then catch the packets that 39 * ether_output() left on our output queue when it calls 40 * if_start(), rewrite them for use by the real outgoing interface, 41 * and ask it to send them. 42 * 43 * 44 * XXX It's incorrect to assume that we must always kludge up 45 * headers on the physical device's behalf: some devices support 46 * VLAN tag insertion and extraction in firmware. For these cases, 47 * one can change the behavior of the vlan interface by setting 48 * the LINK0 flag on it (that is setting the vlan interface's LINK0 49 * flag, _not_ the parent's LINK0 flag; we try to leave the parent 50 * alone). If the interface has the LINK0 flag set, then it will 51 * not modify the ethernet header on output, because the parent 52 * can do that for itself. On input, the parent can call vlan_input_tag() 53 * directly in order to supply us with an incoming mbuf and the vlan 54 * tag value that goes with it. 55 */ 56 57 #include "opt_inet.h" 58 59 #include <sys/param.h> 60 #include <sys/kernel.h> 61 #include <sys/malloc.h> 62 #include <sys/mbuf.h> 63 #include <sys/module.h> 64 #include <sys/queue.h> 65 #include <sys/socket.h> 66 #include <sys/sockio.h> 67 #include <sys/sysctl.h> 68 #include <sys/systm.h> 69 70 #include <net/bpf.h> 71 #include <net/ethernet.h> 72 #include <net/if.h> 73 #include <net/if_arp.h> 74 #include <net/if_dl.h> 75 #include <net/if_types.h> 76 #include <net/if_vlan_var.h> 77 78 #ifdef INET 79 #include <netinet/in.h> 80 #include <netinet/if_ether.h> 81 #endif 82 83 #define VLANNAME "vlan" 84 85 SYSCTL_DECL(_net_link); 86 SYSCTL_NODE(_net_link, IFT_L2VLAN, vlan, CTLFLAG_RW, 0, "IEEE 802.1Q VLAN"); 87 SYSCTL_NODE(_net_link_vlan, PF_LINK, link, CTLFLAG_RW, 0, "for consistency"); 88 89 static MALLOC_DEFINE(M_VLAN, "vlan", "802.1Q Virtual LAN Interface"); 90 static LIST_HEAD(, ifvlan) ifv_list; 91 92 static int vlan_clone_create(struct if_clone *, int); 93 static int vlan_clone_destroy(struct ifnet *); 94 static void vlan_start(struct ifnet *ifp); 95 static void vlan_ifinit(void *foo); 96 static int vlan_input(struct ether_header *eh, struct mbuf *m); 97 static int vlan_input_tag(struct ether_header *eh, struct mbuf *m, 98 u_int16_t t); 99 static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); 100 static int vlan_setmulti(struct ifnet *ifp); 101 static int vlan_unconfig(struct ifnet *ifp); 102 static int vlan_config(struct ifvlan *ifv, struct ifnet *p); 103 104 struct if_clone vlan_cloner = IF_CLONE_INITIALIZER("vlan", 105 vlan_clone_create, vlan_clone_destroy, IF_MAXUNIT); 106 107 /* 108 * Program our multicast filter. What we're actually doing is 109 * programming the multicast filter of the parent. This has the 110 * side effect of causing the parent interface to receive multicast 111 * traffic that it doesn't really want, which ends up being discarded 112 * later by the upper protocol layers. Unfortunately, there's no way 113 * to avoid this: there really is only one physical interface. 114 */ 115 static int 116 vlan_setmulti(struct ifnet *ifp) 117 { 118 struct ifnet *ifp_p; 119 struct ifmultiaddr *ifma, *rifma = NULL; 120 struct ifvlan *sc; 121 struct vlan_mc_entry *mc = NULL; 122 struct sockaddr_dl sdl; 123 int error; 124 125 /* Find the parent. */ 126 sc = ifp->if_softc; 127 ifp_p = sc->ifv_p; 128 129 /* 130 * If we don't have a parent, just remember the membership for 131 * when we do. 132 */ 133 if (ifp_p == NULL) 134 return(0); 135 136 bzero((char *)&sdl, sizeof sdl); 137 sdl.sdl_len = sizeof sdl; 138 sdl.sdl_family = AF_LINK; 139 sdl.sdl_index = ifp_p->if_index; 140 sdl.sdl_type = IFT_ETHER; 141 sdl.sdl_alen = ETHER_ADDR_LEN; 142 143 /* First, remove any existing filter entries. */ 144 while(SLIST_FIRST(&sc->vlan_mc_listhead) != NULL) { 145 mc = SLIST_FIRST(&sc->vlan_mc_listhead); 146 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN); 147 error = if_delmulti(ifp_p, (struct sockaddr *)&sdl); 148 if (error) 149 return(error); 150 SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries); 151 free(mc, M_VLAN); 152 } 153 154 /* Now program new ones. */ 155 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 156 if (ifma->ifma_addr->sa_family != AF_LINK) 157 continue; 158 mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK); 159 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 160 (char *)&mc->mc_addr, ETHER_ADDR_LEN); 161 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); 162 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 163 LLADDR(&sdl), ETHER_ADDR_LEN); 164 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma); 165 if (error) 166 return(error); 167 } 168 169 return(0); 170 } 171 172 static int 173 vlan_modevent(module_t mod, int type, void *data) 174 { 175 176 switch (type) { 177 case MOD_LOAD: 178 LIST_INIT(&ifv_list); 179 vlan_input_p = vlan_input; 180 vlan_input_tag_p = vlan_input_tag; 181 if_clone_attach(&vlan_cloner); 182 break; 183 case MOD_UNLOAD: 184 if_clone_detach(&vlan_cloner); 185 vlan_input_p = NULL; 186 vlan_input_tag_p = NULL; 187 while (!LIST_EMPTY(&ifv_list)) 188 vlan_clone_destroy(&LIST_FIRST(&ifv_list)->ifv_if); 189 break; 190 } 191 return 0; 192 } 193 194 static moduledata_t vlan_mod = { 195 "if_vlan", 196 vlan_modevent, 197 0 198 }; 199 200 DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); 201 202 static int 203 vlan_clone_create(struct if_clone *ifc, int unit) 204 { 205 struct ifvlan *ifv; 206 struct ifnet *ifp; 207 int s; 208 209 ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); 210 ifp = &ifv->ifv_if; 211 SLIST_INIT(&ifv->vlan_mc_listhead); 212 213 s = splnet(); 214 LIST_INSERT_HEAD(&ifv_list, ifv, ifv_list); 215 splx(s); 216 217 ifp->if_softc = ifv; 218 ifp->if_name = "vlan"; 219 ifp->if_unit = unit; 220 /* NB: flags are not set here */ 221 ifp->if_linkmib = &ifv->ifv_mib; 222 ifp->if_linkmiblen = sizeof ifv->ifv_mib; 223 /* NB: mtu is not set here */ 224 225 ifp->if_init = vlan_ifinit; 226 ifp->if_start = vlan_start; 227 ifp->if_ioctl = vlan_ioctl; 228 ifp->if_output = ether_output; 229 ifp->if_snd.ifq_maxlen = ifqmaxlen; 230 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); 231 /* Now undo some of the damage... */ 232 ifp->if_baudrate = 0; 233 ifp->if_data.ifi_type = IFT_L2VLAN; 234 ifp->if_data.ifi_hdrlen = EVL_ENCAPLEN; 235 236 return (0); 237 } 238 239 static int 240 vlan_clone_destroy(struct ifnet *ifp) 241 { 242 struct ifvlan *ifv = ifp->if_softc; 243 int s; 244 245 s = splnet(); 246 LIST_REMOVE(ifv, ifv_list); 247 vlan_unconfig(ifp); 248 splx(s); 249 250 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); 251 252 free(ifv, M_VLAN); 253 return (0); 254 } 255 256 static void 257 vlan_ifinit(void *foo) 258 { 259 return; 260 } 261 262 static void 263 vlan_start(struct ifnet *ifp) 264 { 265 struct ifvlan *ifv; 266 struct ifnet *p; 267 struct ether_vlan_header *evl; 268 struct mbuf *m; 269 270 ifv = ifp->if_softc; 271 p = ifv->ifv_p; 272 273 ifp->if_flags |= IFF_OACTIVE; 274 for (;;) { 275 IF_DEQUEUE(&ifp->if_snd, m); 276 if (m == 0) 277 break; 278 if (ifp->if_bpf) 279 bpf_mtap(ifp, m); 280 281 /* 282 * Do not run parent's if_start() if the parent is not up, 283 * or parent's driver will cause a system crash. 284 */ 285 if ((p->if_flags & (IFF_UP | IFF_RUNNING)) != 286 (IFF_UP | IFF_RUNNING)) { 287 m_freem(m); 288 ifp->if_data.ifi_collisions++; 289 continue; 290 } 291 292 /* 293 * If the LINK0 flag is set, it means the underlying interface 294 * can do VLAN tag insertion itself and doesn't require us to 295 * create a special header for it. In this case, we just pass 296 * the packet along. However, we need some way to tell the 297 * interface where the packet came from so that it knows how 298 * to find the VLAN tag to use, so we set the rcvif in the 299 * mbuf header to our ifnet. 300 * 301 * Note: we also set the M_PROTO1 flag in the mbuf to let 302 * the parent driver know that the rcvif pointer is really 303 * valid. We need to do this because sometimes mbufs will 304 * be allocated by other parts of the system that contain 305 * garbage in the rcvif pointer. Using the M_PROTO1 flag 306 * lets the driver perform a proper sanity check and avoid 307 * following potentially bogus rcvif pointers off into 308 * never-never land. 309 */ 310 if (ifp->if_flags & IFF_LINK0) { 311 m->m_pkthdr.rcvif = ifp; 312 m->m_flags |= M_PROTO1; 313 } else { 314 M_PREPEND(m, EVL_ENCAPLEN, M_DONTWAIT); 315 if (m == NULL) { 316 printf("vlan%d: M_PREPEND failed", ifp->if_unit); 317 ifp->if_ierrors++; 318 continue; 319 } 320 /* M_PREPEND takes care of m_len, m_pkthdr.len for us */ 321 322 m = m_pullup(m, ETHER_HDR_LEN + EVL_ENCAPLEN); 323 if (m == NULL) { 324 printf("vlan%d: m_pullup failed", ifp->if_unit); 325 ifp->if_ierrors++; 326 continue; 327 } 328 329 /* 330 * Transform the Ethernet header into an Ethernet header 331 * with 802.1Q encapsulation. 332 */ 333 bcopy(mtod(m, char *) + EVL_ENCAPLEN, mtod(m, char *), 334 sizeof(struct ether_header)); 335 evl = mtod(m, struct ether_vlan_header *); 336 evl->evl_proto = evl->evl_encap_proto; 337 evl->evl_encap_proto = htons(ETHERTYPE_VLAN); 338 evl->evl_tag = htons(ifv->ifv_tag); 339 #ifdef DEBUG 340 printf("vlan_start: %*D\n", sizeof *evl, 341 (unsigned char *)evl, ":"); 342 #endif 343 } 344 345 /* 346 * Send it, precisely as ether_output() would have. 347 * We are already running at splimp. 348 */ 349 if (IF_HANDOFF(&p->if_snd, m, p)) 350 ifp->if_opackets++; 351 else 352 ifp->if_oerrors++; 353 } 354 ifp->if_flags &= ~IFF_OACTIVE; 355 356 return; 357 } 358 359 static int 360 vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t) 361 { 362 struct ifvlan *ifv; 363 364 /* 365 * Fake up a header and send the packet to the physical interface's 366 * bpf tap if active. 367 */ 368 if (m->m_pkthdr.rcvif->if_bpf != NULL) { 369 struct m_hdr mh; 370 struct ether_vlan_header evh; 371 372 bcopy(eh, &evh, 2*ETHER_ADDR_LEN); 373 evh.evl_encap_proto = htons(ETHERTYPE_VLAN); 374 evh.evl_tag = htons(t); 375 evh.evl_proto = eh->ether_type; 376 377 /* This kludge is OK; BPF treats the "mbuf" as read-only */ 378 mh.mh_next = m; 379 mh.mh_data = (char *)&evh; 380 mh.mh_len = ETHER_HDR_LEN + EVL_ENCAPLEN; 381 bpf_mtap(m->m_pkthdr.rcvif, (struct mbuf *)&mh); 382 } 383 384 for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; 385 ifv = LIST_NEXT(ifv, ifv_list)) { 386 if (m->m_pkthdr.rcvif == ifv->ifv_p 387 && ifv->ifv_tag == t) 388 break; 389 } 390 391 if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) { 392 m_free(m); 393 return -1; /* So the parent can take note */ 394 } 395 396 /* 397 * Having found a valid vlan interface corresponding to 398 * the given source interface and vlan tag, run the 399 * the real packet through ether_input(). 400 */ 401 m->m_pkthdr.rcvif = &ifv->ifv_if; 402 403 ifv->ifv_if.if_ipackets++; 404 ether_input(&ifv->ifv_if, eh, m); 405 return 0; 406 } 407 408 static int 409 vlan_input(struct ether_header *eh, struct mbuf *m) 410 { 411 struct ifvlan *ifv; 412 413 for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; 414 ifv = LIST_NEXT(ifv, ifv_list)) { 415 if (m->m_pkthdr.rcvif == ifv->ifv_p 416 && (EVL_VLANOFTAG(ntohs(*mtod(m, u_int16_t *))) 417 == ifv->ifv_tag)) 418 break; 419 } 420 421 if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) { 422 m_freem(m); 423 return -1; /* so ether_input can take note */ 424 } 425 426 /* 427 * Having found a valid vlan interface corresponding to 428 * the given source interface and vlan tag, remove the 429 * encapsulation, and run the real packet through 430 * ether_input() a second time (it had better be 431 * reentrant!). 432 */ 433 m->m_pkthdr.rcvif = &ifv->ifv_if; 434 eh->ether_type = mtod(m, u_int16_t *)[1]; 435 m->m_data += EVL_ENCAPLEN; 436 m->m_len -= EVL_ENCAPLEN; 437 m->m_pkthdr.len -= EVL_ENCAPLEN; 438 439 ifv->ifv_if.if_ipackets++; 440 ether_input(&ifv->ifv_if, eh, m); 441 return 0; 442 } 443 444 static int 445 vlan_config(struct ifvlan *ifv, struct ifnet *p) 446 { 447 struct ifaddr *ifa1, *ifa2; 448 struct sockaddr_dl *sdl1, *sdl2; 449 450 if (p->if_data.ifi_type != IFT_ETHER) 451 return EPROTONOSUPPORT; 452 if (ifv->ifv_p) 453 return EBUSY; 454 ifv->ifv_p = p; 455 if (p->if_data.ifi_hdrlen == sizeof(struct ether_vlan_header)) 456 ifv->ifv_if.if_mtu = p->if_mtu; 457 else 458 ifv->ifv_if.if_mtu = p->if_data.ifi_mtu - EVL_ENCAPLEN; 459 460 /* 461 * Copy only a selected subset of flags from the parent. 462 * Other flags are none of our business. 463 */ 464 ifv->ifv_if.if_flags = (p->if_flags & 465 (IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX | IFF_POINTOPOINT)); 466 467 /* 468 * Set up our ``Ethernet address'' to reflect the underlying 469 * physical interface's. 470 */ 471 ifa1 = ifaddr_byindex(ifv->ifv_if.if_index); 472 ifa2 = ifaddr_byindex(p->if_index); 473 sdl1 = (struct sockaddr_dl *)ifa1->ifa_addr; 474 sdl2 = (struct sockaddr_dl *)ifa2->ifa_addr; 475 sdl1->sdl_type = IFT_ETHER; 476 sdl1->sdl_alen = ETHER_ADDR_LEN; 477 bcopy(LLADDR(sdl2), LLADDR(sdl1), ETHER_ADDR_LEN); 478 bcopy(LLADDR(sdl2), ifv->ifv_ac.ac_enaddr, ETHER_ADDR_LEN); 479 480 /* 481 * Configure multicast addresses that may already be 482 * joined on the vlan device. 483 */ 484 (void)vlan_setmulti(&ifv->ifv_if); 485 486 return 0; 487 } 488 489 static int 490 vlan_unconfig(struct ifnet *ifp) 491 { 492 struct ifaddr *ifa; 493 struct sockaddr_dl *sdl; 494 struct vlan_mc_entry *mc; 495 struct ifvlan *ifv; 496 struct ifnet *p; 497 int error; 498 499 ifv = ifp->if_softc; 500 p = ifv->ifv_p; 501 502 if (p) { 503 struct sockaddr_dl sdl; 504 505 /* 506 * Since the interface is being unconfigured, we need to 507 * empty the list of multicast groups that we may have joined 508 * while we were alive from the parent's list. 509 */ 510 bzero((char *)&sdl, sizeof sdl); 511 sdl.sdl_len = sizeof sdl; 512 sdl.sdl_family = AF_LINK; 513 sdl.sdl_index = p->if_index; 514 sdl.sdl_type = IFT_ETHER; 515 sdl.sdl_alen = ETHER_ADDR_LEN; 516 517 while(SLIST_FIRST(&ifv->vlan_mc_listhead) != NULL) { 518 mc = SLIST_FIRST(&ifv->vlan_mc_listhead); 519 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN); 520 error = if_delmulti(p, (struct sockaddr *)&sdl); 521 if (error) 522 return(error); 523 SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries); 524 free(mc, M_VLAN); 525 } 526 } 527 528 /* Disconnect from parent. */ 529 ifv->ifv_p = NULL; 530 ifv->ifv_if.if_mtu = ETHERMTU; 531 532 /* Clear our MAC address. */ 533 ifa = ifaddr_byindex(ifv->ifv_if.if_index); 534 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 535 sdl->sdl_type = IFT_ETHER; 536 sdl->sdl_alen = ETHER_ADDR_LEN; 537 bzero(LLADDR(sdl), ETHER_ADDR_LEN); 538 bzero(ifv->ifv_ac.ac_enaddr, ETHER_ADDR_LEN); 539 540 return 0; 541 } 542 543 static int 544 vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 545 { 546 struct ifaddr *ifa; 547 struct ifnet *p; 548 struct ifreq *ifr; 549 struct ifvlan *ifv; 550 struct vlanreq vlr; 551 int error = 0; 552 553 ifr = (struct ifreq *)data; 554 ifa = (struct ifaddr *)data; 555 ifv = ifp->if_softc; 556 557 switch (cmd) { 558 case SIOCSIFADDR: 559 ifp->if_flags |= IFF_UP; 560 561 switch (ifa->ifa_addr->sa_family) { 562 #ifdef INET 563 case AF_INET: 564 arp_ifinit(&ifv->ifv_if, ifa); 565 break; 566 #endif 567 default: 568 break; 569 } 570 break; 571 572 case SIOCGIFADDR: 573 { 574 struct sockaddr *sa; 575 576 sa = (struct sockaddr *) &ifr->ifr_data; 577 bcopy(((struct arpcom *)ifp->if_softc)->ac_enaddr, 578 (caddr_t) sa->sa_data, ETHER_ADDR_LEN); 579 } 580 break; 581 582 case SIOCSIFMTU: 583 /* 584 * Set the interface MTU. 585 * This is bogus. The underlying interface might support 586 * jumbo frames. 587 */ 588 if (ifr->ifr_mtu > ETHERMTU) { 589 error = EINVAL; 590 } else { 591 ifp->if_mtu = ifr->ifr_mtu; 592 } 593 break; 594 595 case SIOCSETVLAN: 596 error = copyin(ifr->ifr_data, &vlr, sizeof vlr); 597 if (error) 598 break; 599 if (vlr.vlr_parent[0] == '\0') { 600 vlan_unconfig(ifp); 601 if (ifp->if_flags & IFF_UP) { 602 int s = splimp(); 603 if_down(ifp); 604 splx(s); 605 } 606 ifp->if_flags &= ~IFF_RUNNING; 607 break; 608 } 609 p = ifunit(vlr.vlr_parent); 610 if (p == 0) { 611 error = ENOENT; 612 break; 613 } 614 error = vlan_config(ifv, p); 615 if (error) 616 break; 617 ifv->ifv_tag = vlr.vlr_tag; 618 ifp->if_flags |= IFF_RUNNING; 619 break; 620 621 case SIOCGETVLAN: 622 bzero(&vlr, sizeof vlr); 623 if (ifv->ifv_p) { 624 snprintf(vlr.vlr_parent, sizeof(vlr.vlr_parent), 625 "%s%d", ifv->ifv_p->if_name, ifv->ifv_p->if_unit); 626 vlr.vlr_tag = ifv->ifv_tag; 627 } 628 error = copyout(&vlr, ifr->ifr_data, sizeof vlr); 629 break; 630 631 case SIOCSIFFLAGS: 632 /* 633 * We don't support promiscuous mode 634 * right now because it would require help from the 635 * underlying drivers, which hasn't been implemented. 636 */ 637 if (ifr->ifr_flags & (IFF_PROMISC)) { 638 ifp->if_flags &= ~(IFF_PROMISC); 639 error = EINVAL; 640 } 641 break; 642 case SIOCADDMULTI: 643 case SIOCDELMULTI: 644 error = vlan_setmulti(ifp); 645 break; 646 default: 647 error = EINVAL; 648 } 649 return error; 650 } 651