blob: 205536a014e83e5547b31459a8fd3ad9389491eb [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __NET_IPIP_H
2#define __NET_IPIP_H 1
3
4#include <linux/if_tunnel.h>
Herbert Xuc439cb22008-01-11 19:14:00 -08005#include <net/ip.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
7/* Keep error state on tunnel for 30 sec */
8#define IPTUNNEL_ERR_TIMEO (30*HZ)
9
10struct ip_tunnel
11{
12 struct ip_tunnel *next;
13 struct net_device *dev;
14 struct net_device_stats stat;
15
16 int recursion; /* Depth of hard_start_xmit recursion */
17 int err_count; /* Number of arrived ICMP errors */
18 unsigned long err_time; /* Time when the last ICMP error arrived */
19
20 /* These four fields used only by GRE */
21 __u32 i_seqno; /* The last seen seqno */
22 __u32 o_seqno; /* The last output seqno */
23 int hlen; /* Precalculated GRE header length */
24 int mlink;
25
26 struct ip_tunnel_parm parms;
Templin, Fred Lfadf6bf2008-03-11 18:35:59 -040027 struct ip_tunnel_prl_entry *prl; /* potential router list */
28};
29
30struct ip_tunnel_prl_entry
31{
32 struct ip_tunnel_prl_entry *next;
33 struct ip_tunnel_prl entry;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034};
35
36#define IPTUNNEL_XMIT() do { \
37 int err; \
38 int pkt_len = skb->len; \
39 \
40 skb->ip_summed = CHECKSUM_NONE; \
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 ip_select_ident(iph, &rt->u.dst, NULL); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 \
Herbert Xuc439cb22008-01-11 19:14:00 -080043 err = ip_local_out(skb); \
Gerrit Renkerb9df3cb2006-11-14 11:21:36 -020044 if (net_xmit_eval(err) == 0) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 stats->tx_bytes += pkt_len; \
46 stats->tx_packets++; \
47 } else { \
48 stats->tx_errors++; \
49 stats->tx_aborted_errors++; \
50 } \
51} while (0)
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#endif