Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __NET_IPIP_H |
| 2 | #define __NET_IPIP_H 1 |
| 3 | |
| 4 | #include <linux/if_tunnel.h> |
Herbert Xu | c439cb2 | 2008-01-11 19:14:00 -0800 | [diff] [blame] | 5 | #include <net/ip.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
| 7 | /* Keep error state on tunnel for 30 sec */ |
| 8 | #define IPTUNNEL_ERR_TIMEO (30*HZ) |
| 9 | |
| 10 | struct ip_tunnel |
| 11 | { |
| 12 | struct ip_tunnel *next; |
| 13 | struct net_device *dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | int err_count; /* Number of arrived ICMP errors */ |
| 16 | unsigned long err_time; /* Time when the last ICMP error arrived */ |
| 17 | |
| 18 | /* These four fields used only by GRE */ |
| 19 | __u32 i_seqno; /* The last seen seqno */ |
| 20 | __u32 o_seqno; /* The last output seqno */ |
| 21 | int hlen; /* Precalculated GRE header length */ |
| 22 | int mlink; |
| 23 | |
| 24 | struct ip_tunnel_parm parms; |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 25 | |
Templin, Fred L | fadf6bf | 2008-03-11 18:35:59 -0400 | [diff] [blame] | 26 | struct ip_tunnel_prl_entry *prl; /* potential router list */ |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 27 | unsigned int prl_count; /* # of entries in PRL */ |
Templin, Fred L | fadf6bf | 2008-03-11 18:35:59 -0400 | [diff] [blame] | 28 | }; |
| 29 | |
Sascha Hlusiak | 6450692 | 2009-05-19 12:56:52 +0000 | [diff] [blame] | 30 | /* ISATAP: default interval between RS in secondy */ |
| 31 | #define IPTUNNEL_RS_DEFAULT_DELAY (900) |
| 32 | |
Templin, Fred L | fadf6bf | 2008-03-11 18:35:59 -0400 | [diff] [blame] | 33 | struct ip_tunnel_prl_entry |
| 34 | { |
| 35 | struct ip_tunnel_prl_entry *next; |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 36 | __be32 addr; |
| 37 | u16 flags; |
Sascha Hlusiak | 6450692 | 2009-05-19 12:56:52 +0000 | [diff] [blame] | 38 | unsigned long rs_delay; |
| 39 | struct timer_list rs_timer; |
| 40 | struct ip_tunnel *tunnel; |
| 41 | spinlock_t lock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | #define IPTUNNEL_XMIT() do { \ |
| 45 | int err; \ |
Herbert Xu | 64194c3 | 2008-10-09 12:03:17 -0700 | [diff] [blame] | 46 | int pkt_len = skb->len - skb_transport_offset(skb); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | \ |
| 48 | skb->ip_summed = CHECKSUM_NONE; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | ip_select_ident(iph, &rt->u.dst, NULL); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | \ |
Herbert Xu | c439cb2 | 2008-01-11 19:14:00 -0800 | [diff] [blame] | 51 | err = ip_local_out(skb); \ |
Gerrit Renker | b9df3cb | 2006-11-14 11:21:36 -0200 | [diff] [blame] | 52 | if (net_xmit_eval(err) == 0) { \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | stats->tx_bytes += pkt_len; \ |
| 54 | stats->tx_packets++; \ |
| 55 | } else { \ |
| 56 | stats->tx_errors++; \ |
| 57 | stats->tx_aborted_errors++; \ |
| 58 | } \ |
| 59 | } while (0) |
| 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #endif |