ng_ether.c revision 126011
1 2/* 3 * ng_ether.c 4 * 5 * Copyright (c) 1996-2000 Whistle Communications, Inc. 6 * All rights reserved. 7 * 8 * Subject to the following obligations and disclaimer of warranty, use and 9 * redistribution of this software, in source or object code forms, with or 10 * without modifications are expressly permitted by Whistle Communications; 11 * provided, however, that: 12 * 1. Any and all reproductions of the source or object code must include the 13 * copyright notice above and the following disclaimer of warranties; and 14 * 2. No rights are granted, in any manner or form, to use Whistle 15 * Communications, Inc. trademarks, including the mark "WHISTLE 16 * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 17 * such appears in the above copyright notice or in the software. 18 * 19 * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 20 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 21 * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 22 * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 24 * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 25 * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 26 * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 27 * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 28 * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 29 * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30 * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35 * OF SUCH DAMAGE. 36 * 37 * Authors: Archie Cobbs <archie@freebsd.org> 38 * Julian Elischer <julian@freebsd.org> 39 * 40 * $FreeBSD: head/sys/netgraph/ng_ether.c 126011 2004-02-19 16:58:01Z pjd $ 41 */ 42 43/* 44 * ng_ether(4) netgraph node type 45 */ 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/malloc.h> 51#include <sys/mbuf.h> 52#include <sys/errno.h> 53#include <sys/syslog.h> 54#include <sys/socket.h> 55 56#include <net/if.h> 57#include <net/if_types.h> 58#include <net/if_arp.h> 59#include <net/if_var.h> 60#include <net/ethernet.h> 61 62#include <netgraph/ng_message.h> 63#include <netgraph/netgraph.h> 64#include <netgraph/ng_parse.h> 65#include <netgraph/ng_ether.h> 66 67#define IFP2AC(IFP) ((struct arpcom *)IFP) 68#define IFP2NG(ifp) ((struct ng_node *)((struct arpcom *)(ifp))->ac_netgraph) 69 70typedef struct ng_ether_private *priv_p; 71 72/* Hook pointers used by if_ethersubr.c to callback to netgraph */ 73extern void (*ng_ether_input_p)(struct ifnet *ifp, struct mbuf **mp); 74extern void (*ng_ether_input_orphan_p)(struct ifnet *ifp, struct mbuf *m); 75extern int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp); 76extern void (*ng_ether_attach_p)(struct ifnet *ifp); 77extern void (*ng_ether_detach_p)(struct ifnet *ifp); 78 79/* Functional hooks called from if_ethersubr.c */ 80static void ng_ether_input(struct ifnet *ifp, struct mbuf **mp); 81static void ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m); 82static int ng_ether_output(struct ifnet *ifp, struct mbuf **mp); 83static void ng_ether_attach(struct ifnet *ifp); 84static void ng_ether_detach(struct ifnet *ifp); 85 86/* Other functions */ 87static void ng_ether_input2(node_p node, struct mbuf **mp); 88static int ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta); 89static int ng_ether_rcv_upper(node_p node, struct mbuf *m, meta_p meta); 90 91/* Netgraph node methods */ 92static ng_constructor_t ng_ether_constructor; 93static ng_rcvmsg_t ng_ether_rcvmsg; 94static ng_shutdown_t ng_ether_shutdown; 95static ng_newhook_t ng_ether_newhook; 96static ng_connect_t ng_ether_connect; 97static ng_rcvdata_t ng_ether_rcvdata; 98static ng_disconnect_t ng_ether_disconnect; 99static int ng_ether_mod_event(module_t mod, int event, void *data); 100 101/* List of commands and how to convert arguments to/from ASCII */ 102static const struct ng_cmdlist ng_ether_cmdlist[] = { 103 { 104 NGM_ETHER_COOKIE, 105 NGM_ETHER_GET_IFNAME, 106 "getifname", 107 NULL, 108 &ng_parse_string_type 109 }, 110 { 111 NGM_ETHER_COOKIE, 112 NGM_ETHER_GET_IFINDEX, 113 "getifindex", 114 NULL, 115 &ng_parse_int32_type 116 }, 117 { 118 NGM_ETHER_COOKIE, 119 NGM_ETHER_GET_ENADDR, 120 "getenaddr", 121 NULL, 122 &ng_parse_enaddr_type 123 }, 124 { 125 NGM_ETHER_COOKIE, 126 NGM_ETHER_SET_ENADDR, 127 "setenaddr", 128 &ng_parse_enaddr_type, 129 NULL 130 }, 131 { 132 NGM_ETHER_COOKIE, 133 NGM_ETHER_GET_PROMISC, 134 "getpromisc", 135 NULL, 136 &ng_parse_int32_type 137 }, 138 { 139 NGM_ETHER_COOKIE, 140 NGM_ETHER_SET_PROMISC, 141 "setpromisc", 142 &ng_parse_int32_type, 143 NULL 144 }, 145 { 146 NGM_ETHER_COOKIE, 147 NGM_ETHER_GET_AUTOSRC, 148 "getautosrc", 149 NULL, 150 &ng_parse_int32_type 151 }, 152 { 153 NGM_ETHER_COOKIE, 154 NGM_ETHER_SET_AUTOSRC, 155 "setautosrc", 156 &ng_parse_int32_type, 157 NULL 158 }, 159 { 0 } 160}; 161 162static struct ng_type ng_ether_typestruct = { 163 NG_ABI_VERSION, 164 NG_ETHER_NODE_TYPE, 165 ng_ether_mod_event, 166 ng_ether_constructor, 167 ng_ether_rcvmsg, 168 ng_ether_shutdown, 169 ng_ether_newhook, 170 NULL, 171 ng_ether_connect, 172 ng_ether_rcvdata, 173 ng_ether_disconnect, 174 ng_ether_cmdlist, 175}; 176MODULE_VERSION(ng_ether, 1); 177NETGRAPH_INIT(ether, &ng_ether_typestruct); 178 179/****************************************************************** 180 ETHERNET FUNCTION HOOKS 181******************************************************************/ 182 183/* 184 * Handle a packet that has come in on an interface. We get to 185 * look at it here before any upper layer protocols do. 186 * 187 * NOTE: this function will get called at splimp() 188 */ 189static void 190ng_ether_input(struct ifnet *ifp, struct mbuf **mp) 191{ 192 const node_p node = IFP2NG(ifp); 193 const priv_p priv = NG_NODE_PRIVATE(node); 194 195 /* If "lower" hook not connected, let packet continue */ 196 if (priv->lower == NULL || priv->lowerOrphan) 197 return; 198 ng_ether_input2(node, mp); 199} 200 201/* 202 * Handle a packet that has come in on an interface, and which 203 * does not match any of our known protocols (an ``orphan''). 204 * 205 * NOTE: this function will get called at splimp() 206 */ 207static void 208ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m) 209{ 210 const node_p node = IFP2NG(ifp); 211 const priv_p priv = NG_NODE_PRIVATE(node); 212 213 /* If "orphan" hook not connected, let packet continue */ 214 if (priv->lower == NULL || !priv->lowerOrphan) { 215 m_freem(m); 216 return; 217 } 218 ng_ether_input2(node, &m); 219 if (m != NULL) 220 m_freem(m); 221} 222 223/* 224 * Handle a packet that has come in on an ethernet interface. 225 * The Ethernet header has already been detached from the mbuf, 226 * so we have to put it back. 227 * 228 * NOTE: this function will get called at splimp() 229 */ 230static void 231ng_ether_input2(node_p node, struct mbuf **mp) 232{ 233 const priv_p priv = NG_NODE_PRIVATE(node); 234 int error; 235 236 /* Send out lower/orphan hook */ 237 NG_SEND_DATA_ONLY(error, priv->lower, *mp); 238 *mp = NULL; 239} 240 241/* 242 * Handle a packet that is going out on an interface. 243 * The Ethernet header is already attached to the mbuf. 244 */ 245static int 246ng_ether_output(struct ifnet *ifp, struct mbuf **mp) 247{ 248 const node_p node = IFP2NG(ifp); 249 const priv_p priv = NG_NODE_PRIVATE(node); 250 int error = 0; 251 252 /* If "upper" hook not connected, let packet continue */ 253 if (priv->upper == NULL) 254 return (0); 255 256 /* Send it out "upper" hook */ 257 NG_SEND_DATA_ONLY(error, priv->upper, *mp); 258 return (error); 259} 260 261/* 262 * A new Ethernet interface has been attached. 263 * Create a new node for it, etc. 264 */ 265static void 266ng_ether_attach(struct ifnet *ifp) 267{ 268 priv_p priv; 269 node_p node; 270 271 /* Create node */ 272 KASSERT(!IFP2NG(ifp), ("%s: node already exists?", __func__)); 273 if (ng_make_node_common(&ng_ether_typestruct, &node) != 0) { 274 log(LOG_ERR, "%s: can't %s for %s\n", 275 __func__, "create node", ifp->if_xname); 276 return; 277 } 278 279 /* Allocate private data */ 280 MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); 281 if (priv == NULL) { 282 log(LOG_ERR, "%s: can't %s for %s\n", 283 __func__, "allocate memory", ifp->if_xname); 284 NG_NODE_UNREF(node); 285 return; 286 } 287 NG_NODE_SET_PRIVATE(node, priv); 288 priv->ifp = ifp; 289 IFP2NG(ifp) = node; 290 priv->autoSrcAddr = 1; 291 priv->hwassist = ifp->if_hwassist; 292 293 /* Try to give the node the same name as the interface */ 294 if (ng_name_node(node, ifp->if_xname) != 0) { 295 log(LOG_WARNING, "%s: can't name node %s\n", 296 __func__, ifp->if_xname); 297 } 298} 299 300/* 301 * An Ethernet interface is being detached. 302 * REALLY Destroy its node. 303 */ 304static void 305ng_ether_detach(struct ifnet *ifp) 306{ 307 const node_p node = IFP2NG(ifp); 308 const priv_p priv = NG_NODE_PRIVATE(node); 309 310 if (node == NULL) /* no node (why not?), ignore */ 311 return; 312 NG_NODE_REALLY_DIE(node); /* Force real removal of node */ 313 /* 314 * We can't assume the ifnet is still around when we run shutdown 315 * So zap it now. XXX We HOPE that anything running at this time 316 * handles it (as it should in the non netgraph case). 317 */ 318 IFP2NG(ifp) = NULL; 319 priv->ifp = NULL; /* XXX race if interrupted an output packet */ 320 ng_rmnode_self(node); /* remove all netgraph parts */ 321} 322 323/****************************************************************** 324 NETGRAPH NODE METHODS 325******************************************************************/ 326 327/* 328 * It is not possible or allowable to create a node of this type. 329 * Nodes get created when the interface is attached (or, when 330 * this node type's KLD is loaded). 331 */ 332static int 333ng_ether_constructor(node_p node) 334{ 335 return (EINVAL); 336} 337 338/* 339 * Check for attaching a new hook. 340 */ 341static int 342ng_ether_newhook(node_p node, hook_p hook, const char *name) 343{ 344 const priv_p priv = NG_NODE_PRIVATE(node); 345 u_char orphan = priv->lowerOrphan; 346 hook_p *hookptr; 347 348 /* Divert hook is an alias for lower */ 349 if (strcmp(name, NG_ETHER_HOOK_DIVERT) == 0) 350 name = NG_ETHER_HOOK_LOWER; 351 352 /* Which hook? */ 353 if (strcmp(name, NG_ETHER_HOOK_UPPER) == 0) 354 hookptr = &priv->upper; 355 else if (strcmp(name, NG_ETHER_HOOK_LOWER) == 0) { 356 hookptr = &priv->lower; 357 orphan = 0; 358 } else if (strcmp(name, NG_ETHER_HOOK_ORPHAN) == 0) { 359 hookptr = &priv->lower; 360 orphan = 1; 361 } else 362 return (EINVAL); 363 364 /* Check if already connected (shouldn't be, but doesn't hurt) */ 365 if (*hookptr != NULL) 366 return (EISCONN); 367 368 /* Disable hardware checksums while 'upper' hook is connected */ 369 if (hookptr == &priv->upper) 370 priv->ifp->if_hwassist = 0; 371 372 /* OK */ 373 *hookptr = hook; 374 priv->lowerOrphan = orphan; 375 return (0); 376} 377 378/* 379 * Hooks are attached, adjust to force queueing. 380 * We don't really care which hook it is. 381 * they should all be queuing for outgoing data. 382 */ 383static int 384ng_ether_connect(hook_p hook) 385{ 386 NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); 387 return (0); 388} 389 390/* 391 * Receive an incoming control message. 392 */ 393static int 394ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) 395{ 396 const priv_p priv = NG_NODE_PRIVATE(node); 397 struct ng_mesg *resp = NULL; 398 int error = 0; 399 struct ng_mesg *msg; 400 401 NGI_GET_MSG(item, msg); 402 switch (msg->header.typecookie) { 403 case NGM_ETHER_COOKIE: 404 switch (msg->header.cmd) { 405 case NGM_ETHER_GET_IFNAME: 406 NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT); 407 if (resp == NULL) { 408 error = ENOMEM; 409 break; 410 } 411 strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ + 1); 412 break; 413 case NGM_ETHER_GET_IFINDEX: 414 NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); 415 if (resp == NULL) { 416 error = ENOMEM; 417 break; 418 } 419 *((u_int32_t *)resp->data) = priv->ifp->if_index; 420 break; 421 case NGM_ETHER_GET_ENADDR: 422 NG_MKRESPONSE(resp, msg, ETHER_ADDR_LEN, M_NOWAIT); 423 if (resp == NULL) { 424 error = ENOMEM; 425 break; 426 } 427 bcopy((IFP2AC(priv->ifp))->ac_enaddr, 428 resp->data, ETHER_ADDR_LEN); 429 break; 430 case NGM_ETHER_SET_ENADDR: 431 { 432 if (msg->header.arglen != ETHER_ADDR_LEN) { 433 error = EINVAL; 434 break; 435 } 436 error = if_setlladdr(priv->ifp, 437 (u_char *)msg->data, ETHER_ADDR_LEN); 438 break; 439 } 440 case NGM_ETHER_GET_PROMISC: 441 NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); 442 if (resp == NULL) { 443 error = ENOMEM; 444 break; 445 } 446 *((u_int32_t *)resp->data) = priv->promisc; 447 break; 448 case NGM_ETHER_SET_PROMISC: 449 { 450 u_char want; 451 452 if (msg->header.arglen != sizeof(u_int32_t)) { 453 error = EINVAL; 454 break; 455 } 456 want = !!*((u_int32_t *)msg->data); 457 if (want ^ priv->promisc) { 458 if ((error = ifpromisc(priv->ifp, want)) != 0) 459 break; 460 priv->promisc = want; 461 } 462 break; 463 } 464 case NGM_ETHER_GET_AUTOSRC: 465 NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); 466 if (resp == NULL) { 467 error = ENOMEM; 468 break; 469 } 470 *((u_int32_t *)resp->data) = priv->autoSrcAddr; 471 break; 472 case NGM_ETHER_SET_AUTOSRC: 473 if (msg->header.arglen != sizeof(u_int32_t)) { 474 error = EINVAL; 475 break; 476 } 477 priv->autoSrcAddr = !!*((u_int32_t *)msg->data); 478 break; 479 default: 480 error = EINVAL; 481 break; 482 } 483 break; 484 default: 485 error = EINVAL; 486 break; 487 } 488 NG_RESPOND_MSG(error, node, item, resp); 489 NG_FREE_MSG(msg); 490 return (error); 491} 492 493/* 494 * Receive data on a hook. 495 */ 496static int 497ng_ether_rcvdata(hook_p hook, item_p item) 498{ 499 const node_p node = NG_HOOK_NODE(hook); 500 const priv_p priv = NG_NODE_PRIVATE(node); 501 struct mbuf *m; 502 meta_p meta; 503 504 NGI_GET_M(item, m); 505 NGI_GET_META(item, meta); 506 NG_FREE_ITEM(item); 507 if (hook == priv->lower) 508 return ng_ether_rcv_lower(node, m, meta); 509 if (hook == priv->upper) 510 return ng_ether_rcv_upper(node, m, meta); 511 panic("%s: weird hook", __func__); 512#ifdef RESTARTABLE_PANICS /* so we don;t get an error msg in LINT */ 513 return NULL; 514#endif 515} 516 517/* 518 * Handle an mbuf received on the "lower" hook. 519 */ 520static int 521ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta) 522{ 523 const priv_p priv = NG_NODE_PRIVATE(node); 524 struct ifnet *const ifp = priv->ifp; 525 526 /* Discard meta info */ 527 NG_FREE_META(meta); 528 529 /* Check whether interface is ready for packets */ 530 if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { 531 NG_FREE_M(m); 532 return (ENETDOWN); 533 } 534 535 /* Make sure header is fully pulled up */ 536 if (m->m_pkthdr.len < sizeof(struct ether_header)) { 537 NG_FREE_M(m); 538 return (EINVAL); 539 } 540 if (m->m_len < sizeof(struct ether_header) 541 && (m = m_pullup(m, sizeof(struct ether_header))) == NULL) 542 return (ENOBUFS); 543 544 /* Drop in the MAC address if desired */ 545 if (priv->autoSrcAddr) { 546 547 /* Make the mbuf writable if it's not already */ 548 if (!M_WRITABLE(m) 549 && (m = m_pullup(m, sizeof(struct ether_header))) == NULL) 550 return (ENOBUFS); 551 552 /* Overwrite source MAC address */ 553 bcopy((IFP2AC(ifp))->ac_enaddr, 554 mtod(m, struct ether_header *)->ether_shost, 555 ETHER_ADDR_LEN); 556 } 557 558 /* Send it on its way */ 559 return ether_output_frame(ifp, m); 560} 561 562/* 563 * Handle an mbuf received on the "upper" hook. 564 */ 565static int 566ng_ether_rcv_upper(node_p node, struct mbuf *m, meta_p meta) 567{ 568 const priv_p priv = NG_NODE_PRIVATE(node); 569 570 /* Discard meta info */ 571 NG_FREE_META(meta); 572 573 m->m_pkthdr.rcvif = priv->ifp; 574 575 /* Route packet back in */ 576 ether_demux(priv->ifp, m); 577 return (0); 578} 579 580/* 581 * Shutdown node. This resets the node but does not remove it 582 * unless the REALLY_DIE flag is set. 583 */ 584static int 585ng_ether_shutdown(node_p node) 586{ 587 const priv_p priv = NG_NODE_PRIVATE(node); 588 589 if (node->nd_flags & NG_REALLY_DIE) { 590 /* 591 * WE came here because the ethernet card is being unloaded, 592 * so stop being persistant. 593 * Actually undo all the things we did on creation. 594 * Assume the ifp has already been freed. 595 */ 596 NG_NODE_SET_PRIVATE(node, NULL); 597 FREE(priv, M_NETGRAPH); 598 NG_NODE_UNREF(node); /* free node itself */ 599 return (0); 600 } 601 if (priv->promisc) { /* disable promiscuous mode */ 602 (void)ifpromisc(priv->ifp, 0); 603 priv->promisc = 0; 604 } 605 priv->autoSrcAddr = 1; /* reset auto-src-addr flag */ 606 node->nd_flags &= ~NG_INVALID; /* Signal ng_rmnode we are persisant */ 607 return (0); 608} 609 610/* 611 * Hook disconnection. 612 */ 613static int 614ng_ether_disconnect(hook_p hook) 615{ 616 const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); 617 618 if (hook == priv->upper) { 619 priv->upper = NULL; 620 if (priv->ifp != NULL) /* restore h/w csum */ 621 priv->ifp->if_hwassist = priv->hwassist; 622 } else if (hook == priv->lower) { 623 priv->lower = NULL; 624 priv->lowerOrphan = 0; 625 } else 626 panic("%s: weird hook", __func__); 627 if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0) 628 && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook)))) 629 ng_rmnode_self(NG_HOOK_NODE(hook)); /* reset node */ 630 return (0); 631} 632 633/****************************************************************** 634 INITIALIZATION 635******************************************************************/ 636 637/* 638 * Handle loading and unloading for this node type. 639 */ 640static int 641ng_ether_mod_event(module_t mod, int event, void *data) 642{ 643 struct ifnet *ifp; 644 int error = 0; 645 int s; 646 647 s = splnet(); 648 switch (event) { 649 case MOD_LOAD: 650 651 /* Register function hooks */ 652 if (ng_ether_attach_p != NULL) { 653 error = EEXIST; 654 break; 655 } 656 ng_ether_attach_p = ng_ether_attach; 657 ng_ether_detach_p = ng_ether_detach; 658 ng_ether_output_p = ng_ether_output; 659 ng_ether_input_p = ng_ether_input; 660 ng_ether_input_orphan_p = ng_ether_input_orphan; 661 662 /* Create nodes for any already-existing Ethernet interfaces */ 663 IFNET_RLOCK(); 664 TAILQ_FOREACH(ifp, &ifnet, if_link) { 665 if (ifp->if_type == IFT_ETHER 666 || ifp->if_type == IFT_L2VLAN) 667 ng_ether_attach(ifp); 668 } 669 IFNET_RUNLOCK(); 670 break; 671 672 case MOD_UNLOAD: 673 674 /* 675 * Note that the base code won't try to unload us until 676 * all nodes have been removed, and that can't happen 677 * until all Ethernet interfaces are removed. In any 678 * case, we know there are no nodes left if the action 679 * is MOD_UNLOAD, so there's no need to detach any nodes. 680 */ 681 682 /* Unregister function hooks */ 683 ng_ether_attach_p = NULL; 684 ng_ether_detach_p = NULL; 685 ng_ether_output_p = NULL; 686 ng_ether_input_p = NULL; 687 ng_ether_input_orphan_p = NULL; 688 break; 689 690 default: 691 error = EOPNOTSUPP; 692 break; 693 } 694 splx(s); 695 return (error); 696} 697 698