mroute.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef __LINUX_MROUTE_H
  2. #define __LINUX_MROUTE_H
  3. #include <linux/in.h>
  4. #include <linux/pim.h>
  5. #include <net/sock.h>
  6. #include <uapi/linux/mroute.h>
  7. #ifdef CONFIG_IP_MROUTE
  8. static inline int ip_mroute_opt(int opt)
  9. {
  10. return (opt >= MRT_BASE) && (opt <= MRT_MAX);
  11. }
  12. #else
  13. static inline int ip_mroute_opt(int opt)
  14. {
  15. return 0;
  16. }
  17. #endif
  18. #ifdef CONFIG_IP_MROUTE
  19. extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
  20. extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
  21. extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
  22. extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
  23. extern int ip_mr_init(void);
  24. #else
  25. static inline
  26. int ip_mroute_setsockopt(struct sock *sock,
  27. int optname, char __user *optval, unsigned int optlen)
  28. {
  29. return -ENOPROTOOPT;
  30. }
  31. static inline
  32. int ip_mroute_getsockopt(struct sock *sock,
  33. int optname, char __user *optval, int __user *optlen)
  34. {
  35. return -ENOPROTOOPT;
  36. }
  37. static inline
  38. int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
  39. {
  40. return -ENOIOCTLCMD;
  41. }
  42. static inline int ip_mr_init(void)
  43. {
  44. return 0;
  45. }
  46. #endif
  47. struct vif_device {
  48. struct net_device *dev; /* Device we are using */
  49. unsigned long bytes_in,bytes_out;
  50. unsigned long pkt_in,pkt_out; /* Statistics */
  51. unsigned long rate_limit; /* Traffic shaping (NI) */
  52. unsigned char threshold; /* TTL threshold */
  53. unsigned short flags; /* Control flags */
  54. __be32 local,remote; /* Addresses(remote for tunnels)*/
  55. int link; /* Physical interface index */
  56. };
  57. #define VIFF_STATIC 0x8000
  58. struct mfc_cache {
  59. struct list_head list;
  60. __be32 mfc_mcastgrp; /* Group the entry belongs to */
  61. __be32 mfc_origin; /* Source of packet */
  62. vifi_t mfc_parent; /* Source interface */
  63. int mfc_flags; /* Flags on line */
  64. union {
  65. struct {
  66. unsigned long expires;
  67. struct sk_buff_head unresolved; /* Unresolved buffers */
  68. } unres;
  69. struct {
  70. unsigned long last_assert;
  71. int minvif;
  72. int maxvif;
  73. unsigned long bytes;
  74. unsigned long pkt;
  75. unsigned long wrong_if;
  76. unsigned char ttls[MAXVIFS]; /* TTL thresholds */
  77. } res;
  78. } mfc_un;
  79. struct rcu_head rcu;
  80. };
  81. #define MFC_STATIC 1
  82. #define MFC_NOTIFY 2
  83. #define MFC_LINES 64
  84. #ifdef __BIG_ENDIAN
  85. #define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
  86. #else
  87. #define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
  88. #endif
  89. struct rtmsg;
  90. extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
  91. __be32 saddr, __be32 daddr,
  92. struct rtmsg *rtm, int nowait, u32 portid);
  93. #endif