0001
0002 #ifndef __LINUX_MROUTE6_H
0003 #define __LINUX_MROUTE6_H
0004
0005
0006 #include <linux/pim.h>
0007 #include <linux/skbuff.h> /* for struct sk_buff_head */
0008 #include <net/net_namespace.h>
0009 #include <uapi/linux/mroute6.h>
0010 #include <linux/mroute_base.h>
0011 #include <linux/sockptr.h>
0012 #include <net/fib_rules.h>
0013
0014 #ifdef CONFIG_IPV6_MROUTE
0015 static inline int ip6_mroute_opt(int opt)
0016 {
0017 return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
0018 }
0019 #else
0020 static inline int ip6_mroute_opt(int opt)
0021 {
0022 return 0;
0023 }
0024 #endif
0025
0026 struct sock;
0027
0028 #ifdef CONFIG_IPV6_MROUTE
0029 extern int ip6_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);
0030 extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
0031 extern int ip6_mr_input(struct sk_buff *skb);
0032 extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
0033 extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
0034 extern int ip6_mr_init(void);
0035 extern void ip6_mr_cleanup(void);
0036 #else
0037 static inline int ip6_mroute_setsockopt(struct sock *sock, int optname,
0038 sockptr_t optval, unsigned int optlen)
0039 {
0040 return -ENOPROTOOPT;
0041 }
0042
0043 static inline
0044 int ip6_mroute_getsockopt(struct sock *sock,
0045 int optname, char __user *optval, int __user *optlen)
0046 {
0047 return -ENOPROTOOPT;
0048 }
0049
0050 static inline
0051 int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
0052 {
0053 return -ENOIOCTLCMD;
0054 }
0055
0056 static inline int ip6_mr_init(void)
0057 {
0058 return 0;
0059 }
0060
0061 static inline void ip6_mr_cleanup(void)
0062 {
0063 return;
0064 }
0065 #endif
0066
0067 #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
0068 bool ip6mr_rule_default(const struct fib_rule *rule);
0069 #else
0070 static inline bool ip6mr_rule_default(const struct fib_rule *rule)
0071 {
0072 return true;
0073 }
0074 #endif
0075
0076 #define VIFF_STATIC 0x8000
0077
0078 struct mfc6_cache_cmp_arg {
0079 struct in6_addr mf6c_mcastgrp;
0080 struct in6_addr mf6c_origin;
0081 };
0082
0083 struct mfc6_cache {
0084 struct mr_mfc _c;
0085 union {
0086 struct {
0087 struct in6_addr mf6c_mcastgrp;
0088 struct in6_addr mf6c_origin;
0089 };
0090 struct mfc6_cache_cmp_arg cmparg;
0091 };
0092 };
0093
0094 #define MFC_ASSERT_THRESH (3*HZ)
0095
0096 struct rtmsg;
0097 extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
0098 struct rtmsg *rtm, u32 portid);
0099
0100 #ifdef CONFIG_IPV6_MROUTE
0101 bool mroute6_is_socket(struct net *net, struct sk_buff *skb);
0102 extern int ip6mr_sk_done(struct sock *sk);
0103 #else
0104 static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb)
0105 {
0106 return false;
0107 }
0108 static inline int ip6mr_sk_done(struct sock *sk)
0109 {
0110 return 0;
0111 }
0112 #endif
0113 #endif