ipip.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. struct ip_tunnel
  8. {
  9. struct ip_tunnel *next;
  10. struct net_device *dev;
  11. int err_count; /* Number of arrived ICMP errors */
  12. unsigned long err_time; /* Time when the last ICMP error arrived */
  13. /* These four fields used only by GRE */
  14. __u32 i_seqno; /* The last seen seqno */
  15. __u32 o_seqno; /* The last output seqno */
  16. int hlen; /* Precalculated GRE header length */
  17. int mlink;
  18. struct ip_tunnel_parm parms;
  19. struct ip_tunnel_prl_entry *prl; /* potential router list */
  20. unsigned int prl_count; /* # of entries in PRL */
  21. };
  22. /* ISATAP: default interval between RS in secondy */
  23. #define IPTUNNEL_RS_DEFAULT_DELAY (900)
  24. struct ip_tunnel_prl_entry
  25. {
  26. struct ip_tunnel_prl_entry *next;
  27. __be32 addr;
  28. u16 flags;
  29. unsigned long rs_delay;
  30. struct timer_list rs_timer;
  31. struct ip_tunnel *tunnel;
  32. spinlock_t lock;
  33. };
  34. #define IPTUNNEL_XMIT() do { \
  35. int err; \
  36. int pkt_len = skb->len - skb_transport_offset(skb); \
  37. \
  38. skb->ip_summed = CHECKSUM_NONE; \
  39. ip_select_ident(iph, &rt->u.dst, NULL); \
  40. \
  41. err = ip_local_out(skb); \
  42. if (net_xmit_eval(err) == 0) { \
  43. stats->tx_bytes += pkt_len; \
  44. stats->tx_packets++; \
  45. } else { \
  46. stats->tx_errors++; \
  47. stats->tx_aborted_errors++; \
  48. } \
  49. } while (0)
  50. #endif