Deleted Added
full compact
if_gif.h (249925) if_gif.h (273087)
1/* $FreeBSD: head/sys/net/if_gif.h 249925 2013-04-26 12:50:32Z glebius $ */
1/* $FreeBSD: head/sys/net/if_gif.h 273087 2014-10-14 13:31:47Z ae $ */
2/* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa 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

--- 15 unchanged lines hidden (view full) ---

25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
2/* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa 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

--- 15 unchanged lines hidden (view full) ---

25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/*
34 * if_gif.h
35 */
36
37#ifndef _NET_IF_GIF_H_
38#define _NET_IF_GIF_H_
39
33#ifndef _NET_IF_GIF_H_
34#define _NET_IF_GIF_H_
35
40
41#ifdef _KERNEL
42#include "opt_inet.h"
43#include "opt_inet6.h"
44
45#include <netinet/in.h>
36#ifdef _KERNEL
37#include "opt_inet.h"
38#include "opt_inet6.h"
39
40#include <netinet/in.h>
46/* xxx sigh, why route have struct route instead of pointer? */
47
41
42struct ip;
43struct ip6_hdr;
48struct encaptab;
49
50extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,
51 int af);
52extern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m,
53 int af);
54extern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp);
55extern void (*ng_gif_attach_p)(struct ifnet *ifp);
56extern void (*ng_gif_detach_p)(struct ifnet *ifp);
57
58struct gif_softc {
44struct encaptab;
45
46extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,
47 int af);
48extern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m,
49 int af);
50extern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp);
51extern void (*ng_gif_attach_p)(struct ifnet *ifp);
52extern void (*ng_gif_detach_p)(struct ifnet *ifp);
53
54struct gif_softc {
59 struct ifnet *gif_ifp;
60 struct mtx gif_mtx;
61 struct sockaddr *gif_psrc; /* Physical src addr */
62 struct sockaddr *gif_pdst; /* Physical dst addr */
55 struct ifnet *gif_ifp;
56 struct rmlock gif_lock;
57 const struct encaptab *gif_ecookie;
58 int gif_family;
59 int gif_flags;
60 u_int gif_fibnum;
61 u_int gif_options;
62 void *gif_netgraph; /* netgraph node info */
63 union {
63 union {
64 struct route gifscr_ro; /* xxx */
64 void *hdr;
65 struct ip *iphdr;
65#ifdef INET6
66#ifdef INET6
66 struct route_in6 gifscr_ro6; /* xxx */
67 struct ip6_hdr *ip6hdr;
67#endif
68#endif
68 } gifsc_gifscr;
69 int gif_flags;
70 u_int gif_fibnum;
71 const struct encaptab *encap_cookie4;
72 const struct encaptab *encap_cookie6;
73 void *gif_netgraph; /* ng_gif(4) netgraph node info */
74 u_int gif_options;
75 LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */
69 } gif_uhdr;
70 LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */
76};
77#define GIF2IFP(sc) ((sc)->gif_ifp)
71};
72#define GIF2IFP(sc) ((sc)->gif_ifp)
78#define GIF_LOCK_INIT(sc) mtx_init(&(sc)->gif_mtx, "gif softc", \
79 NULL, MTX_DEF)
80#define GIF_LOCK_DESTROY(sc) mtx_destroy(&(sc)->gif_mtx)
81#define GIF_LOCK(sc) mtx_lock(&(sc)->gif_mtx)
82#define GIF_UNLOCK(sc) mtx_unlock(&(sc)->gif_mtx)
83#define GIF_LOCK_ASSERT(sc) mtx_assert(&(sc)->gif_mtx, MA_OWNED)
73#define GIF_LOCK_INIT(sc) rm_init(&(sc)->gif_lock, "gif softc")
74#define GIF_LOCK_DESTROY(sc) rm_destroy(&(sc)->gif_lock)
75#define GIF_RLOCK_TRACKER struct rm_priotracker gif_tracker
76#define GIF_RLOCK(sc) rm_rlock(&(sc)->gif_lock, &gif_tracker)
77#define GIF_RUNLOCK(sc) rm_runlock(&(sc)->gif_lock, &gif_tracker)
78#define GIF_RLOCK_ASSERT(sc) rm_assert(&(sc)->gif_lock, RA_RLOCKED)
79#define GIF_WLOCK(sc) rm_wlock(&(sc)->gif_lock)
80#define GIF_WUNLOCK(sc) rm_wunlock(&(sc)->gif_lock)
81#define GIF_WLOCK_ASSERT(sc) rm_assert(&(sc)->gif_lock, RA_WLOCKED)
84
82
85#define gif_ro gifsc_gifscr.gifscr_ro
83#define gif_iphdr gif_uhdr.iphdr
84#define gif_hdr gif_uhdr.hdr
86#ifdef INET6
85#ifdef INET6
87#define gif_ro6 gifsc_gifscr.gifscr_ro6
86#define gif_ip6hdr gif_uhdr.ip6hdr
88#endif
89
90#define GIF_MTU (1280) /* Default MTU */
91#define GIF_MTU_MIN (1280) /* Minimum MTU */
92#define GIF_MTU_MAX (8192) /* Maximum MTU */
93
94#define MTAG_GIF 1080679712
95#define MTAG_GIF_CALLED 0

--- 10 unchanged lines hidden (view full) ---

106 u_int8_t eip_resvh; /* reserved */
107} __packed;
108
109#define ETHERIP_VERSION 0x3
110/* mbuf adjust factor to force 32-bit alignment of IP header */
111#define ETHERIP_ALIGN 2
112
113/* Prototypes */
87#endif
88
89#define GIF_MTU (1280) /* Default MTU */
90#define GIF_MTU_MIN (1280) /* Minimum MTU */
91#define GIF_MTU_MAX (8192) /* Maximum MTU */
92
93#define MTAG_GIF 1080679712
94#define MTAG_GIF_CALLED 0

--- 10 unchanged lines hidden (view full) ---

105 u_int8_t eip_resvh; /* reserved */
106} __packed;
107
108#define ETHERIP_VERSION 0x3
109/* mbuf adjust factor to force 32-bit alignment of IP header */
110#define ETHERIP_ALIGN 2
111
112/* Prototypes */
114void gif_input(struct mbuf *, int, struct ifnet *);
113void gif_input(struct mbuf *, struct ifnet *, int, uint8_t);
115int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
116 struct route *);
114int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
115 struct route *);
117int gif_ioctl(struct ifnet *, u_long, caddr_t);
118int gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *);
119void gif_delete_tunnel(struct ifnet *);
120int gif_encapcheck(const struct mbuf *, int, int, void *);
121#endif /* _KERNEL */
122
123#define GIFGOPTS _IOWR('i', 150, struct ifreq)
124#define GIFSOPTS _IOW('i', 151, struct ifreq)
125
126#define GIF_ACCEPT_REVETHIP 0x0001
127#define GIF_SEND_REVETHIP 0x0010
128#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
129
130#endif /* _NET_IF_GIF_H_ */
116int gif_encapcheck(const struct mbuf *, int, int, void *);
117#endif /* _KERNEL */
118
119#define GIFGOPTS _IOWR('i', 150, struct ifreq)
120#define GIFSOPTS _IOW('i', 151, struct ifreq)
121
122#define GIF_ACCEPT_REVETHIP 0x0001
123#define GIF_SEND_REVETHIP 0x0010
124#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
125
126#endif /* _NET_IF_GIF_H_ */