ip6_tunnel.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _NET_IP6_TUNNEL_H
  2. #define _NET_IP6_TUNNEL_H
  3. #include <linux/ipv6.h>
  4. #include <linux/netdevice.h>
  5. #include <linux/ip6_tunnel.h>
  6. #define IP6TUNNEL_ERR_TIMEO (30*HZ)
  7. /* capable of sending packets */
  8. #define IP6_TNL_F_CAP_XMIT 0x10000
  9. /* capable of receiving packets */
  10. #define IP6_TNL_F_CAP_RCV 0x20000
  11. /* determine capability on a per-packet basis */
  12. #define IP6_TNL_F_CAP_PER_PACKET 0x40000
  13. struct __ip6_tnl_parm {
  14. char name[IFNAMSIZ]; /* name of tunnel device */
  15. int link; /* ifindex of underlying L2 interface */
  16. __u8 proto; /* tunnel protocol */
  17. __u8 encap_limit; /* encapsulation limit for tunnel */
  18. __u8 hop_limit; /* hop limit for tunnel */
  19. __be32 flowinfo; /* traffic class and flowlabel for tunnel */
  20. __u32 flags; /* tunnel flags */
  21. struct in6_addr laddr; /* local tunnel end-point address */
  22. struct in6_addr raddr; /* remote tunnel end-point address */
  23. __be16 i_flags;
  24. __be16 o_flags;
  25. __be32 i_key;
  26. __be32 o_key;
  27. };
  28. /* IPv6 tunnel */
  29. struct ip6_tnl {
  30. struct ip6_tnl __rcu *next; /* next tunnel in list */
  31. struct net_device *dev; /* virtual device associated with tunnel */
  32. struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
  33. struct flowi fl; /* flowi template for xmit */
  34. struct dst_entry *dst_cache; /* cached dst */
  35. u32 dst_cookie;
  36. int err_count;
  37. unsigned long err_time;
  38. /* These fields used only by GRE */
  39. __u32 i_seqno; /* The last seen seqno */
  40. __u32 o_seqno; /* The last output seqno */
  41. int hlen; /* Precalculated GRE header length */
  42. int mlink;
  43. };
  44. /* Tunnel encapsulation limit destination sub-option */
  45. struct ipv6_tlv_tnl_enc_lim {
  46. __u8 type; /* type-code for option */
  47. __u8 length; /* option length */
  48. __u8 encap_limit; /* tunnel encapsulation limit */
  49. } __packed;
  50. struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t);
  51. void ip6_tnl_dst_reset(struct ip6_tnl *t);
  52. void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
  53. int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
  54. const struct in6_addr *raddr);
  55. int ip6_tnl_xmit_ctl(struct ip6_tnl *t);
  56. __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
  57. __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
  58. const struct in6_addr *raddr);
  59. #endif