if_gif.c (241394) | if_gif.c (241610) |
---|---|
1/* $FreeBSD: head/sys/net/if_gif.c 241394 2012-10-10 08:36:38Z kevlo $ */ | 1/* $FreeBSD: head/sys/net/if_gif.c 241610 2012-10-16 13:37:54Z glebius $ */ |
2/* $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 73 unchanged lines hidden (view full) --- 83 84#include <netinet/ip_encap.h> 85#include <net/ethernet.h> 86#include <net/if_bridgevar.h> 87#include <net/if_gif.h> 88 89#include <security/mac/mac_framework.h> 90 | 2/* $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 73 unchanged lines hidden (view full) --- 83 84#include <netinet/ip_encap.h> 85#include <net/ethernet.h> 86#include <net/if_bridgevar.h> 87#include <net/if_gif.h> 88 89#include <security/mac/mac_framework.h> 90 |
91#define GIFNAME "gif" | 91static const char gifname[] = "gif"; |
92 93/* 94 * gif_mtx protects the global gif_softc_list. 95 */ 96static struct mtx gif_mtx; 97static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface"); 98static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list); 99#define V_gif_softc_list VNET(gif_softc_list) 100 101void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af); 102void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af); 103void (*ng_gif_attach_p)(struct ifnet *ifp); 104void (*ng_gif_detach_p)(struct ifnet *ifp); 105 106static void gif_start(struct ifnet *); 107static int gif_clone_create(struct if_clone *, int, caddr_t); 108static void gif_clone_destroy(struct ifnet *); | 92 93/* 94 * gif_mtx protects the global gif_softc_list. 95 */ 96static struct mtx gif_mtx; 97static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface"); 98static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list); 99#define V_gif_softc_list VNET(gif_softc_list) 100 101void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af); 102void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af); 103void (*ng_gif_attach_p)(struct ifnet *ifp); 104void (*ng_gif_detach_p)(struct ifnet *ifp); 105 106static void gif_start(struct ifnet *); 107static int gif_clone_create(struct if_clone *, int, caddr_t); 108static void gif_clone_destroy(struct ifnet *); |
109static struct if_clone *gif_cloner; |
|
109 | 110 |
110IFC_SIMPLE_DECLARE(gif, 0); 111 | |
112static int gifmodevent(module_t, int, void *); 113 114SYSCTL_DECL(_net_link); 115static SYSCTL_NODE(_net_link, IFT_GIF, gif, CTLFLAG_RW, 0, 116 "Generic Tunnel Interface"); 117#ifndef MAX_GIF_NEST 118/* 119 * This macro controls the default upper limitation on nesting of gif tunnels. --- 46 unchanged lines hidden (view full) --- 166 if (GIF2IFP(sc) == NULL) { 167 free(sc, M_GIF); 168 return (ENOSPC); 169 } 170 171 GIF_LOCK_INIT(sc); 172 173 GIF2IFP(sc)->if_softc = sc; | 111static int gifmodevent(module_t, int, void *); 112 113SYSCTL_DECL(_net_link); 114static SYSCTL_NODE(_net_link, IFT_GIF, gif, CTLFLAG_RW, 0, 115 "Generic Tunnel Interface"); 116#ifndef MAX_GIF_NEST 117/* 118 * This macro controls the default upper limitation on nesting of gif tunnels. --- 46 unchanged lines hidden (view full) --- 165 if (GIF2IFP(sc) == NULL) { 166 free(sc, M_GIF); 167 return (ENOSPC); 168 } 169 170 GIF_LOCK_INIT(sc); 171 172 GIF2IFP(sc)->if_softc = sc; |
174 if_initname(GIF2IFP(sc), ifc->ifc_name, unit); | 173 if_initname(GIF2IFP(sc), gifname, unit); |
175 176 sc->encap_cookie4 = sc->encap_cookie6 = NULL; 177 sc->gif_options = GIF_ACCEPT_REVETHIP; 178 179 GIF2IFP(sc)->if_addrlen = 0; 180 GIF2IFP(sc)->if_mtu = GIF_MTU; 181 GIF2IFP(sc)->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; 182#if 0 --- 68 unchanged lines hidden (view full) --- 251 module_t mod; 252 int type; 253 void *data; 254{ 255 256 switch (type) { 257 case MOD_LOAD: 258 mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF); | 174 175 sc->encap_cookie4 = sc->encap_cookie6 = NULL; 176 sc->gif_options = GIF_ACCEPT_REVETHIP; 177 178 GIF2IFP(sc)->if_addrlen = 0; 179 GIF2IFP(sc)->if_mtu = GIF_MTU; 180 GIF2IFP(sc)->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; 181#if 0 --- 68 unchanged lines hidden (view full) --- 250 module_t mod; 251 int type; 252 void *data; 253{ 254 255 switch (type) { 256 case MOD_LOAD: 257 mtx_init(&gif_mtx, "gif_mtx", NULL, MTX_DEF); |
259 if_clone_attach(&gif_cloner); | 258 gif_cloner = if_clone_simple(gifname, gif_clone_create, 259 gif_clone_destroy, 0); |
260 break; 261 262 case MOD_UNLOAD: | 260 break; 261 262 case MOD_UNLOAD: |
263 if_clone_detach(&gif_cloner); | 263 if_clone_detach(gif_cloner); |
264 mtx_destroy(&gif_mtx); 265 break; 266 default: 267 return EOPNOTSUPP; 268 } 269 return 0; 270} 271 --- 805 unchanged lines hidden --- | 264 mtx_destroy(&gif_mtx); 265 break; 266 default: 267 return EOPNOTSUPP; 268 } 269 return 0; 270} 271 --- 805 unchanged lines hidden --- |