ipip.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. struct net_device_stats stat;
  12. int recursion; /* Depth of hard_start_xmit recursion */
  13. int err_count; /* Number of arrived ICMP errors */
  14. unsigned long err_time; /* Time when the last ICMP error arrived */
  15. /* These four fields used only by GRE */
  16. __u32 i_seqno; /* The last seen seqno */
  17. __u32 o_seqno; /* The last output seqno */
  18. int hlen; /* Precalculated GRE header length */
  19. int mlink;
  20. struct ip_tunnel_parm parms;
  21. };
  22. #define IPTUNNEL_XMIT() do { \
  23. int err; \
  24. int pkt_len = skb->len; \
  25. \
  26. skb->ip_summed = CHECKSUM_NONE; \
  27. ip_select_ident(iph, &rt->u.dst, NULL); \
  28. \
  29. err = ip_local_out(skb); \
  30. if (net_xmit_eval(err) == 0) { \
  31. stats->tx_bytes += pkt_len; \
  32. stats->tx_packets++; \
  33. } else { \
  34. stats->tx_errors++; \
  35. stats->tx_aborted_errors++; \
  36. } \
  37. } while (0)
  38. #endif