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; |
| 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; |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 27 | |
Templin, Fred L | fadf6bf | 2008-03-11 18:35:59 -0400 | [diff] [blame] | 28 | struct ip_tunnel_prl_entry *prl; /* potential router list */ |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 29 | unsigned int prl_count; /* # of entries in PRL */ |
Templin, Fred L | fadf6bf | 2008-03-11 18:35:59 -0400 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | struct ip_tunnel_prl_entry |
| 33 | { |
| 34 | struct ip_tunnel_prl_entry *next; |
YOSHIFUJI Hideaki | 300aaee | 2008-03-24 18:28:39 +0900 | [diff] [blame] | 35 | __be32 addr; |
| 36 | u16 flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | #define IPTUNNEL_XMIT() do { \ |
| 40 | int err; \ |
| 41 | int pkt_len = skb->len; \ |
| 42 | \ |
| 43 | skb->ip_summed = CHECKSUM_NONE; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | ip_select_ident(iph, &rt->u.dst, NULL); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | \ |
Herbert Xu | c439cb2 | 2008-01-11 19:14:00 -0800 | [diff] [blame] | 46 | err = ip_local_out(skb); \ |
Gerrit Renker | b9df3cb | 2006-11-14 11:21:36 -0200 | [diff] [blame] | 47 | if (net_xmit_eval(err) == 0) { \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | stats->tx_bytes += pkt_len; \ |
| 49 | stats->tx_packets++; \ |
| 50 | } else { \ |
| 51 | stats->tx_errors++; \ |
| 52 | stats->tx_aborted_errors++; \ |
| 53 | } \ |
| 54 | } while (0) |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #endif |