1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_MROUTE6_H
3 #define __LINUX_MROUTE6_H
7 #include <linux/skbuff.h> /* for struct sk_buff_head */
8 #include <net/net_namespace.h>
9 #include <uapi/linux/mroute6.h>
10 #include <linux/mroute_base.h>
11 #include <linux/sockptr.h>
12 #include <net/fib_rules.h>
14 #ifdef CONFIG_IPV6_MROUTE
15 static inline int ip6_mroute_opt(int opt)
17 return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
20 static inline int ip6_mroute_opt(int opt)
28 #ifdef CONFIG_IPV6_MROUTE
29 extern int ip6_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);
30 extern int ip6_mroute_getsockopt(struct sock *, int, sockptr_t, sockptr_t);
31 extern int ip6_mr_input(struct sk_buff *skb);
32 extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
33 extern int ip6_mr_init(void);
34 extern void ip6_mr_cleanup(void);
35 int ip6mr_ioctl(struct sock *sk, int cmd, void *arg);
37 static inline int ip6_mroute_setsockopt(struct sock *sock, int optname,
38 sockptr_t optval, unsigned int optlen)
44 int ip6_mroute_getsockopt(struct sock *sock,
45 int optname, sockptr_t optval, sockptr_t optlen)
51 int ip6mr_ioctl(struct sock *sk, int cmd, void *arg)
56 static inline int ip6_mr_init(void)
61 static inline void ip6_mr_cleanup(void)
67 #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
68 bool ip6mr_rule_default(const struct fib_rule *rule);
70 static inline bool ip6mr_rule_default(const struct fib_rule *rule)
76 #define VIFF_STATIC 0x8000
78 struct mfc6_cache_cmp_arg {
79 struct in6_addr mf6c_mcastgrp;
80 struct in6_addr mf6c_origin;
87 struct in6_addr mf6c_mcastgrp;
88 struct in6_addr mf6c_origin;
90 struct mfc6_cache_cmp_arg cmparg;
94 #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
97 extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
98 struct rtmsg *rtm, u32 portid);
100 #ifdef CONFIG_IPV6_MROUTE
101 bool mroute6_is_socket(struct net *net, struct sk_buff *skb);
102 extern int ip6mr_sk_done(struct sock *sk);
103 static inline int ip6mr_sk_ioctl(struct sock *sk, unsigned int cmd,
107 /* These userspace buffers will be consumed by ip6mr_ioctl() */
108 case SIOCGETMIFCNT_IN6: {
109 struct sioc_mif_req6 buffer;
111 return sock_ioctl_inout(sk, cmd, arg, &buffer,
114 case SIOCGETSGCNT_IN6: {
115 struct sioc_mif_req6 buffer;
117 return sock_ioctl_inout(sk, cmd, arg, &buffer,
125 static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb)
129 static inline int ip6mr_sk_done(struct sock *sk)
134 static inline int ip6mr_sk_ioctl(struct sock *sk, unsigned int cmd,