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>
11 #ifdef CONFIG_IPV6_MROUTE
12 static inline int ip6_mroute_opt(int opt)
14 return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
17 static inline int ip6_mroute_opt(int opt)
25 #ifdef CONFIG_IPV6_MROUTE
26 extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
27 extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
28 extern int ip6_mr_input(struct sk_buff *skb);
29 extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
30 extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
31 extern int ip6_mr_init(void);
32 extern void ip6_mr_cleanup(void);
35 int ip6_mroute_setsockopt(struct sock *sock,
36 int optname, char __user *optval, unsigned int optlen)
42 int ip6_mroute_getsockopt(struct sock *sock,
43 int optname, char __user *optval, int __user *optlen)
49 int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
54 static inline int ip6_mr_init(void)
59 static inline void ip6_mr_cleanup(void)
66 struct net_device *dev; /* Device we are using */
67 unsigned long bytes_in,bytes_out;
68 unsigned long pkt_in,pkt_out; /* Statistics */
69 unsigned long rate_limit; /* Traffic shaping (NI) */
70 unsigned char threshold; /* TTL threshold */
71 unsigned short flags; /* Control flags */
72 int link; /* Physical interface index */
75 #define VIFF_STATIC 0x8000
78 struct list_head list;
79 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
80 struct in6_addr mf6c_origin; /* Source of packet */
81 mifi_t mf6c_parent; /* Source interface */
82 int mfc_flags; /* Flags on line */
86 unsigned long expires;
87 struct sk_buff_head unresolved; /* Unresolved buffers */
90 unsigned long last_assert;
95 unsigned long wrong_if;
96 unsigned long lastuse;
97 unsigned char ttls[MAXMIFS]; /* TTL thresholds */
105 #define MFC6_LINES 64
107 #define MFC6_HASH(a, g) (((__force u32)(a)->s6_addr32[0] ^ \
108 (__force u32)(a)->s6_addr32[1] ^ \
109 (__force u32)(a)->s6_addr32[2] ^ \
110 (__force u32)(a)->s6_addr32[3] ^ \
111 (__force u32)(g)->s6_addr32[0] ^ \
112 (__force u32)(g)->s6_addr32[1] ^ \
113 (__force u32)(g)->s6_addr32[2] ^ \
114 (__force u32)(g)->s6_addr32[3]) % MFC6_LINES)
116 #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
119 extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
120 struct rtmsg *rtm, u32 portid);
122 #ifdef CONFIG_IPV6_MROUTE
123 extern struct sock *mroute6_socket(struct net *net, struct sk_buff *skb);
124 extern int ip6mr_sk_done(struct sock *sk);
126 static inline struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
130 static inline int ip6mr_sk_done(struct sock *sk)