ng_ether.c (238844) | ng_ether.c (241686) |
---|---|
1 2/* 3 * ng_ether.c 4 */ 5 6/*- 7 * Copyright (c) 1996-2000 Whistle Communications, Inc. 8 * All rights reserved. --- 25 unchanged lines hidden (view full) --- 34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 37 * OF SUCH DAMAGE. 38 * 39 * Authors: Archie Cobbs <archie@freebsd.org> 40 * Julian Elischer <julian@freebsd.org> 41 * | 1 2/* 3 * ng_ether.c 4 */ 5 6/*- 7 * Copyright (c) 1996-2000 Whistle Communications, Inc. 8 * All rights reserved. --- 25 unchanged lines hidden (view full) --- 34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 37 * OF SUCH DAMAGE. 38 * 39 * Authors: Archie Cobbs <archie@freebsd.org> 40 * Julian Elischer <julian@freebsd.org> 41 * |
42 * $FreeBSD: head/sys/netgraph/ng_ether.c 238844 2012-07-27 13:57:28Z emaste $ | 42 * $FreeBSD: head/sys/netgraph/ng_ether.c 241686 2012-10-18 13:57:24Z andre $ |
43 */ 44 45/* 46 * ng_ether(4) netgraph node type 47 */ 48 49#include <sys/param.h> 50#include <sys/systm.h> --- 164 unchanged lines hidden (view full) --- 215 216/****************************************************************** 217 ETHERNET FUNCTION HOOKS 218******************************************************************/ 219 220/* 221 * Handle a packet that has come in on an interface. We get to 222 * look at it here before any upper layer protocols do. | 43 */ 44 45/* 46 * ng_ether(4) netgraph node type 47 */ 48 49#include <sys/param.h> 50#include <sys/systm.h> --- 164 unchanged lines hidden (view full) --- 215 216/****************************************************************** 217 ETHERNET FUNCTION HOOKS 218******************************************************************/ 219 220/* 221 * Handle a packet that has come in on an interface. We get to 222 * look at it here before any upper layer protocols do. |
223 * 224 * NOTE: this function will get called at splimp() | |
225 */ 226static void 227ng_ether_input(struct ifnet *ifp, struct mbuf **mp) 228{ 229 const node_p node = IFP2NG(ifp); 230 const priv_p priv = NG_NODE_PRIVATE(node); 231 int error; 232 233 /* If "lower" hook not connected, let packet continue */ 234 if (priv->lower == NULL) 235 return; 236 NG_SEND_DATA_ONLY(error, priv->lower, *mp); /* sets *mp = NULL */ 237} 238 239/* 240 * Handle a packet that has come in on an interface, and which 241 * does not match any of our known protocols (an ``orphan''). | 223 */ 224static void 225ng_ether_input(struct ifnet *ifp, struct mbuf **mp) 226{ 227 const node_p node = IFP2NG(ifp); 228 const priv_p priv = NG_NODE_PRIVATE(node); 229 int error; 230 231 /* If "lower" hook not connected, let packet continue */ 232 if (priv->lower == NULL) 233 return; 234 NG_SEND_DATA_ONLY(error, priv->lower, *mp); /* sets *mp = NULL */ 235} 236 237/* 238 * Handle a packet that has come in on an interface, and which 239 * does not match any of our known protocols (an ``orphan''). |
242 * 243 * NOTE: this function will get called at splimp() | |
244 */ 245static void 246ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m) 247{ 248 const node_p node = IFP2NG(ifp); 249 const priv_p priv = NG_NODE_PRIVATE(node); 250 int error; 251 --- 502 unchanged lines hidden (view full) --- 754 755/* 756 * Handle loading and unloading for this node type. 757 */ 758static int 759ng_ether_mod_event(module_t mod, int event, void *data) 760{ 761 int error = 0; | 240 */ 241static void 242ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m) 243{ 244 const node_p node = IFP2NG(ifp); 245 const priv_p priv = NG_NODE_PRIVATE(node); 246 int error; 247 --- 502 unchanged lines hidden (view full) --- 750 751/* 752 * Handle loading and unloading for this node type. 753 */ 754static int 755ng_ether_mod_event(module_t mod, int event, void *data) 756{ 757 int error = 0; |
762 int s; | |
763 | 758 |
764 s = splnet(); | |
765 switch (event) { 766 case MOD_LOAD: 767 768 /* Register function hooks */ 769 if (ng_ether_attach_p != NULL) { 770 error = EEXIST; 771 break; 772 } --- 24 unchanged lines hidden (view full) --- 797 ng_ether_input_orphan_p = NULL; 798 ng_ether_link_state_p = NULL; 799 break; 800 801 default: 802 error = EOPNOTSUPP; 803 break; 804 } | 759 switch (event) { 760 case MOD_LOAD: 761 762 /* Register function hooks */ 763 if (ng_ether_attach_p != NULL) { 764 error = EEXIST; 765 break; 766 } --- 24 unchanged lines hidden (view full) --- 791 ng_ether_input_orphan_p = NULL; 792 ng_ether_link_state_p = NULL; 793 break; 794 795 default: 796 error = EOPNOTSUPP; 797 break; 798 } |
805 splx(s); | |
806 return (error); 807} 808 809static void 810vnet_ng_ether_init(const void *unused) 811{ 812 struct ifnet *ifp; 813 --- 15 unchanged lines hidden --- | 799 return (error); 800} 801 802static void 803vnet_ng_ether_init(const void *unused) 804{ 805 struct ifnet *ifp; 806 --- 15 unchanged lines hidden --- |