1/* $FreeBSD: head/sys/net/if_gif.c 215701 2010-11-22 19:32:54Z dim $ */
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
--- 79 unchanged lines hidden (view full) ---
89
90#define GIFNAME "gif"
91
92/*
93 * gif_mtx protects the global gif_softc_list.
94 */
95static struct mtx gif_mtx;
96static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
97static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list);
98#define V_gif_softc_list VNET(gif_softc_list)
99
100void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af);
101void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
102void (*ng_gif_attach_p)(struct ifnet *ifp);
103void (*ng_gif_detach_p)(struct ifnet *ifp);
104
105static void gif_start(struct ifnet *);
--- 13 unchanged lines hidden (view full) ---
119 * Since, setting a large value to this macro with a careless configuration
120 * may introduce system crash, we don't allow any nestings by default.
121 * If you need to configure nested gif tunnels, you can define this macro
122 * in your kernel configuration file. However, if you do so, please be
123 * careful to configure the tunnels so that it won't make a loop.
124 */
125#define MAX_GIF_NEST 1
126#endif
127static VNET_DEFINE(int, max_gif_nesting) = MAX_GIF_NEST;
128#define V_max_gif_nesting VNET(max_gif_nesting)
129SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, max_nesting, CTLFLAG_RW,
130 &VNET_NAME(max_gif_nesting), 0, "Max nested tunnels");
131
132/*
133 * By default, we disallow creation of multiple tunnels between the same
134 * pair of addresses. Some applications require this functionality so
135 * we allow control over this check here.
136 */
137#ifdef XBONEHACK
138static VNET_DEFINE(int, parallel_tunnels) = 1;
139#else
140static VNET_DEFINE(int, parallel_tunnels) = 0;
141#endif
142#define V_parallel_tunnels VNET(parallel_tunnels)
143SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, parallel_tunnels, CTLFLAG_RW,
144 &VNET_NAME(parallel_tunnels), 0, "Allow parallel tunnels?");
145
146/* copy from src/sys/net/if_ethersubr.c */
147static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
148 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
--- 875 unchanged lines hidden ---
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
--- 79 unchanged lines hidden (view full) ---
89
90#define GIFNAME "gif"
91
92/*
93 * gif_mtx protects the global gif_softc_list.
94 */
95static struct mtx gif_mtx;
96static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
97static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list);
98#define V_gif_softc_list VNET(gif_softc_list)
99
100void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af);
101void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
102void (*ng_gif_attach_p)(struct ifnet *ifp);
103void (*ng_gif_detach_p)(struct ifnet *ifp);
104
105static void gif_start(struct ifnet *);
--- 13 unchanged lines hidden (view full) ---
119 * Since, setting a large value to this macro with a careless configuration
120 * may introduce system crash, we don't allow any nestings by default.
121 * If you need to configure nested gif tunnels, you can define this macro
122 * in your kernel configuration file. However, if you do so, please be
123 * careful to configure the tunnels so that it won't make a loop.
124 */
125#define MAX_GIF_NEST 1
126#endif
127static VNET_DEFINE(int, max_gif_nesting) = MAX_GIF_NEST;
128#define V_max_gif_nesting VNET(max_gif_nesting)
129SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, max_nesting, CTLFLAG_RW,
130 &VNET_NAME(max_gif_nesting), 0, "Max nested tunnels");
131
132/*
133 * By default, we disallow creation of multiple tunnels between the same
134 * pair of addresses. Some applications require this functionality so
135 * we allow control over this check here.
136 */
137#ifdef XBONEHACK
138static VNET_DEFINE(int, parallel_tunnels) = 1;
139#else
140static VNET_DEFINE(int, parallel_tunnels) = 0;
141#endif
142#define V_parallel_tunnels VNET(parallel_tunnels)
143SYSCTL_VNET_INT(_net_link_gif, OID_AUTO, parallel_tunnels, CTLFLAG_RW,
144 &VNET_NAME(parallel_tunnels), 0, "Allow parallel tunnels?");
145
146/* copy from src/sys/net/if_ethersubr.c */
147static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
148 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
--- 875 unchanged lines hidden ---