ng_eiface.c (191283) | ng_eiface.c (191510) |
---|---|
1/*- 2 * 3 * Copyright (c) 1999-2001, Vitaly V Belekhov 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/*- 2 * 3 * Copyright (c) 1999-2001, Vitaly V Belekhov 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/netgraph/ng_eiface.c 191283 2009-04-19 22:04:29Z rwatson $ | 28 * $FreeBSD: head/sys/netgraph/ng_eiface.c 191510 2009-04-26 07:14:50Z zec $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/errno.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/mbuf.h> --- 71 unchanged lines hidden (view full) --- 108 .shutdown = ng_eiface_rmnode, 109 .newhook = ng_eiface_newhook, 110 .rcvdata = ng_eiface_rcvdata, 111 .disconnect = ng_eiface_disconnect, 112 .cmdlist = ng_eiface_cmdlist 113}; 114NETGRAPH_INIT(eiface, &typestruct); 115 | 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/errno.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/mbuf.h> --- 71 unchanged lines hidden (view full) --- 108 .shutdown = ng_eiface_rmnode, 109 .newhook = ng_eiface_newhook, 110 .rcvdata = ng_eiface_rcvdata, 111 .disconnect = ng_eiface_disconnect, 112 .cmdlist = ng_eiface_cmdlist 113}; 114NETGRAPH_INIT(eiface, &typestruct); 115 |
116static vnet_attach_fn ng_eiface_iattach; 117static vnet_detach_fn ng_eiface_idetach; 118 |
|
116#ifdef VIMAGE_GLOBALS 117static struct unrhdr *ng_eiface_unit; 118#endif 119 | 119#ifdef VIMAGE_GLOBALS 120static struct unrhdr *ng_eiface_unit; 121#endif 122 |
123#ifndef VIMAGE_GLOBALS 124static vnet_modinfo_t vnet_ng_eiface_modinfo = { 125 .vmi_id = VNET_MOD_NG_EIFACE, 126 .vmi_name = "ng_eiface", 127 .vmi_dependson = VNET_MOD_NETGRAPH, 128 .vmi_iattach = ng_eiface_iattach, 129 .vmi_idetach = ng_eiface_idetach 130}; 131#endif 132 |
|
120/************************************************************************ 121 INTERFACE STUFF 122 ************************************************************************/ 123 124/* 125 * Process an ioctl for the virtual interface 126 */ 127static int --- 457 unchanged lines hidden (view full) --- 585 */ 586static int 587ng_eiface_mod_event(module_t mod, int event, void *data) 588{ 589 int error = 0; 590 591 switch (event) { 592 case MOD_LOAD: | 133/************************************************************************ 134 INTERFACE STUFF 135 ************************************************************************/ 136 137/* 138 * Process an ioctl for the virtual interface 139 */ 140static int --- 457 unchanged lines hidden (view full) --- 598 */ 599static int 600ng_eiface_mod_event(module_t mod, int event, void *data) 601{ 602 int error = 0; 603 604 switch (event) { 605 case MOD_LOAD: |
593 V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL); | 606#ifndef VIMAGE_GLOBALS 607 vnet_mod_register(&vnet_ng_eiface_modinfo); 608#else 609 ng_eiface_iattach(NULL); 610#endif |
594 break; 595 case MOD_UNLOAD: | 611 break; 612 case MOD_UNLOAD: |
596 delete_unrhdr(V_ng_eiface_unit); | 613#ifndef VIMAGE_GLOBALS 614 vnet_mod_deregister(&vnet_ng_eiface_modinfo); 615#else 616 ng_eiface_idetach(NULL); 617#endif |
597 break; 598 default: 599 error = EOPNOTSUPP; 600 break; 601 } 602 return (error); 603} | 618 break; 619 default: 620 error = EOPNOTSUPP; 621 break; 622 } 623 return (error); 624} |
625 626static int ng_eiface_iattach(const void *unused) 627{ 628 INIT_VNET_NETGRAPH(curvnet); 629 630 V_ng_eiface_unit = new_unrhdr(0, 0xffff, NULL); 631 632 return (0); 633} 634 635static int ng_eiface_idetach(const void *unused) 636{ 637 INIT_VNET_NETGRAPH(curvnet); 638 639 delete_unrhdr(V_ng_eiface_unit); 640 641 return (0); 642} |
|