ipip.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __NET_IPIP_H
  2. #define __NET_IPIP_H 1
  3. #include <linux/if_tunnel.h>
  4. #include <net/ip.h>
  5. /* Keep error state on tunnel for 30 sec */
  6. #define IPTUNNEL_ERR_TIMEO (30*HZ)
  7. /* 6rd prefix/relay information */
  8. struct ip_tunnel_6rd_parm {
  9. struct in6_addr prefix;
  10. __be32 relay_prefix;
  11. u16 prefixlen;
  12. u16 relay_prefixlen;
  13. };
  14. struct ip_tunnel {
  15. struct ip_tunnel __rcu *next;
  16. struct net_device *dev;
  17. int err_count; /* Number of arrived ICMP errors */
  18. unsigned long err_time; /* Time when the last ICMP error arrived */
  19. /* These four fields used only by GRE */
  20. __u32 i_seqno; /* The last seen seqno */
  21. __u32 o_seqno; /* The last output seqno */
  22. int hlen; /* Precalculated GRE header length */
  23. int mlink;
  24. struct ip_tunnel_parm parms;
  25. /* for SIT */
  26. #ifdef CONFIG_IPV6_SIT_6RD
  27. struct ip_tunnel_6rd_parm ip6rd;
  28. #endif
  29. struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
  30. unsigned int prl_count; /* # of entries in PRL */
  31. };
  32. struct ip_tunnel_prl_entry {
  33. struct ip_tunnel_prl_entry __rcu *next;
  34. __be32 addr;
  35. u16 flags;
  36. struct rcu_head rcu_head;
  37. };
  38. #define __IPTUNNEL_XMIT(stats1, stats2) do { \
  39. int err; \
  40. int pkt_len = skb->len - skb_transport_offset(skb); \
  41. \
  42. skb->ip_summed = CHECKSUM_NONE; \
  43. ip_select_ident(iph, &rt->dst, NULL); \
  44. \
  45. err = ip_local_out(skb); \
  46. if (likely(net_xmit_eval(err) == 0)) { \
  47. (stats1)->tx_bytes += pkt_len; \
  48. (stats1)->tx_packets++; \
  49. } else { \
  50. (stats2)->tx_errors++; \
  51. (stats2)->tx_aborted_errors++; \
  52. } \
  53. } while (0)
  54. #define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats)
  55. #endif