3 * Copyright (C) 1996, 1997 John Ioannidis.
4 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Richard Guy Briggs.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * RCSID $Id: ipsec_tunnel.h,v 1.1 2004/03/15 20:35:25 as Exp $
19 #include <linux/types.h>
22 # define DEV_QUEUE_XMIT(skb, device, pri) {\
24 neigh_compat_output(skb); \
25 /* skb->dst->output(skb); */ \
27 # define ICMP_SEND(skb_in, type, code, info, dev) \
28 icmp_send(skb_in, type, code, htonl(info))
29 # define IP_SEND(skb, dev) \
32 # define DEV_QUEUE_XMIT(skb, device, pri) {\
33 dev_queue_xmit(skb, device, pri); \
35 # define ICMP_SEND(skb_in, type, code, info, dev) \
36 icmp_send(skb_in, type, code, info, dev)
37 # define IP_SEND(skb, dev) \
38 if(ntohs(iph->tot_len) > physmtu) { \
39 ip_fragment(NULL, skb, dev, 0); \
40 ipsec_kfree_skb(skb); \
42 dev_queue_xmit(skb, dev, SOPRI_NORMAL); \
48 * Heavily based on drivers/net/new_tunnel.c. Lots
49 * of ideas also taken from the 2.1.x version of drivers/net/shaper.c
52 struct ipsectunnelconf
59 #define cf_name cf_u.cfu_name
62 #define IPSEC_SET_DEV (SIOCDEVPRIVATE)
63 #define IPSEC_DEL_DEV (SIOCDEVPRIVATE + 1)
64 #define IPSEC_CLR_DEV (SIOCDEVPRIVATE + 2)
67 #include <linux/version.h>
68 #ifndef KERNEL_VERSION
69 # define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
73 struct sk_buff_head sendq
;
75 struct wait_queue
*wait_queue
;
77 int (*hard_start_xmit
) (struct sk_buff
*skb
,
79 int (*hard_header
) (struct sk_buff
*skb
,
86 int (*rebuild_header
)(struct sk_buff
*skb
);
88 int (*rebuild_header
)(void *buff
, struct device
*dev
,
89 unsigned long raddr
, struct sk_buff
*skb
);
91 int (*set_mac_address
)(struct device
*dev
, void *addr
);
93 void (*header_cache_bind
)(struct hh_cache
**hhp
, struct device
*dev
,
94 unsigned short htype
, __u32 daddr
);
96 void (*header_cache_update
)(struct hh_cache
*hh
, struct device
*dev
, unsigned char * haddr
);
97 struct net_device_stats
*(*get_stats
)(struct device
*dev
);
98 struct net_device_stats mystats
;
99 int mtu
; /* What is the desired MTU? */
102 extern char ipsec_tunnel_c_version
[];
104 extern struct device
*ipsecdevices
[IPSEC_NUM_IF
];
106 int ipsec_tunnel_init_devices(void);
108 /* void */ int ipsec_tunnel_cleanup_devices(void);
110 extern /* void */ int ipsec_init(void);
112 extern int ipsec_tunnel_start_xmit(struct sk_buff
*skb
, struct device
*dev
);
114 #ifdef CONFIG_IPSEC_DEBUG
115 extern int debug_tunnel
;
116 extern int sysctl_ipsec_debug_verbose
;
117 #endif /* CONFIG_IPSEC_DEBUG */
118 #endif /* __KERNEL__ */
120 #ifdef CONFIG_IPSEC_DEBUG
121 #define DB_TN_INIT 0x0001
122 #define DB_TN_PROCFS 0x0002
123 #define DB_TN_XMIT 0x0010
124 #define DB_TN_OHDR 0x0020
125 #define DB_TN_CROUT 0x0040
126 #define DB_TN_OXFS 0x0080
127 #define DB_TN_REVEC 0x0100
128 #endif /* CONFIG_IPSEC_DEBUG */