ipip.h 1.5 KB

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