Blame view

include/net/ipip.h 1.62 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  #ifndef __NET_IPIP_H
  #define __NET_IPIP_H 1
  
  #include <linux/if_tunnel.h>
c439cb2e4   Herbert Xu   [IPV4]: Add ip_lo...
5
  #include <net/ip.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
  
  /* Keep error state on tunnel for 30 sec */
  #define IPTUNNEL_ERR_TIMEO	(30*HZ)
fa857afcf   YOSHIFUJI Hideaki / 吉藤英明   ipv6 sit: 6rd (IP...
9
  /* 6rd prefix/relay information */
fd2c3ef76   Eric Dumazet   net: cleanup incl...
10
  struct ip_tunnel_6rd_parm {
fa857afcf   YOSHIFUJI Hideaki / 吉藤英明   ipv6 sit: 6rd (IP...
11
12
13
14
15
  	struct in6_addr		prefix;
  	__be32			relay_prefix;
  	u16			prefixlen;
  	u16			relay_prefixlen;
  };
fd2c3ef76   Eric Dumazet   net: cleanup incl...
16
  struct ip_tunnel {
6f0bcf152   Eric Dumazet   tunnels: add _rcu...
17
  	struct ip_tunnel __rcu	*next;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
  	struct net_device	*dev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
  	int			err_count;	/* Number of arrived ICMP errors */
  	unsigned long		err_time;	/* Time when the last ICMP error arrived */
  
  	/* These four fields used only by GRE */
  	__u32			i_seqno;	/* The last seen seqno	*/
  	__u32			o_seqno;	/* The last output seqno */
  	int			hlen;		/* Precalculated GRE header length */
  	int			mlink;
  
  	struct ip_tunnel_parm	parms;
300aaeeaa   YOSHIFUJI Hideaki   [IPV6] SIT: Add S...
30

fa857afcf   YOSHIFUJI Hideaki / 吉藤英明   ipv6 sit: 6rd (IP...
31
32
33
34
  	/* for SIT */
  #ifdef CONFIG_IPV6_SIT_6RD
  	struct ip_tunnel_6rd_parm	ip6rd;
  #endif
b33eab084   Eric Dumazet   tunnels: add __rc...
35
  	struct ip_tunnel_prl_entry __rcu *prl;		/* potential router list */
300aaeeaa   YOSHIFUJI Hideaki   [IPV6] SIT: Add S...
36
  	unsigned int			prl_count;	/* # of entries in PRL */
fadf6bf06   Templin, Fred L   [IPV6] SIT: Add P...
37
  };
fd2c3ef76   Eric Dumazet   net: cleanup incl...
38
  struct ip_tunnel_prl_entry {
b33eab084   Eric Dumazet   tunnels: add __rc...
39
  	struct ip_tunnel_prl_entry __rcu *next;
300aaeeaa   YOSHIFUJI Hideaki   [IPV6] SIT: Add S...
40
41
  	__be32				addr;
  	u16				flags;
ef9a9d118   Eric Dumazet   ipv6 sit: RCU con...
42
  	struct rcu_head			rcu_head;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
  };
290b895e0   Eric Dumazet   tunnels: prepare ...
44
  #define __IPTUNNEL_XMIT(stats1, stats2) do {				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
  	int err;							\
64194c31a   Herbert Xu   inet: Make tunnel...
46
  	int pkt_len = skb->len - skb_transport_offset(skb);		\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
  									\
  	skb->ip_summed = CHECKSUM_NONE;					\
d8d1f30b9   Changli Gao   net-next: remove ...
49
  	ip_select_ident(iph, &rt->dst, NULL);				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
  									\
c439cb2e4   Herbert Xu   [IPV4]: Add ip_lo...
51
  	err = ip_local_out(skb);					\
0bfbedb14   Eric Dumazet   tunnels: Optimize...
52
  	if (likely(net_xmit_eval(err) == 0)) {				\
290b895e0   Eric Dumazet   tunnels: prepare ...
53
54
  		(stats1)->tx_bytes += pkt_len;				\
  		(stats1)->tx_packets++;					\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
  	} else {							\
290b895e0   Eric Dumazet   tunnels: prepare ...
56
57
  		(stats2)->tx_errors++;					\
  		(stats2)->tx_aborted_errors++;				\
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
  	}								\
  } while (0)
290b895e0   Eric Dumazet   tunnels: prepare ...
60
  #define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
  #endif