]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
7bc570c8 YH |
2 | #ifndef __LINUX_MROUTE6_H |
3 | #define __LINUX_MROUTE6_H | |
4 | ||
7bc570c8 | 5 | |
7c19a3d2 | 6 | #include <linux/pim.h> |
7bc570c8 | 7 | #include <linux/skbuff.h> /* for struct sk_buff_head */ |
bd91b8bf | 8 | #include <net/net_namespace.h> |
607ca46e | 9 | #include <uapi/linux/mroute6.h> |
6853f21f | 10 | #include <linux/mroute_base.h> |
7bc570c8 | 11 | |
7bc570c8 YH |
12 | #ifdef CONFIG_IPV6_MROUTE |
13 | static inline int ip6_mroute_opt(int opt) | |
14 | { | |
bbb923a4 | 15 | return (opt >= MRT6_BASE) && (opt <= MRT6_MAX); |
7bc570c8 YH |
16 | } |
17 | #else | |
18 | static inline int ip6_mroute_opt(int opt) | |
19 | { | |
20 | return 0; | |
21 | } | |
22 | #endif | |
23 | ||
24 | struct sock; | |
25 | ||
e0835f8f | 26 | #ifdef CONFIG_IPV6_MROUTE |
b7058842 | 27 | extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); |
7bc570c8 YH |
28 | extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); |
29 | extern int ip6_mr_input(struct sk_buff *skb); | |
30 | extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); | |
e2d57766 | 31 | extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); |
623d1a1a WC |
32 | extern int ip6_mr_init(void); |
33 | extern void ip6_mr_cleanup(void); | |
e0835f8f YH |
34 | #else |
35 | static inline | |
36 | int ip6_mroute_setsockopt(struct sock *sock, | |
b7058842 | 37 | int optname, char __user *optval, unsigned int optlen) |
e0835f8f YH |
38 | { |
39 | return -ENOPROTOOPT; | |
40 | } | |
41 | ||
42 | static inline | |
43 | int ip6_mroute_getsockopt(struct sock *sock, | |
44 | int optname, char __user *optval, int __user *optlen) | |
45 | { | |
46 | return -ENOPROTOOPT; | |
47 | } | |
48 | ||
49 | static inline | |
50 | int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg) | |
51 | { | |
52 | return -ENOIOCTLCMD; | |
53 | } | |
54 | ||
55 | static inline int ip6_mr_init(void) | |
56 | { | |
57 | return 0; | |
58 | } | |
59 | ||
60 | static inline void ip6_mr_cleanup(void) | |
61 | { | |
62 | return; | |
63 | } | |
64 | #endif | |
7bc570c8 | 65 | |
7bc570c8 YH |
66 | #define VIFF_STATIC 0x8000 |
67 | ||
87c418bf YM |
68 | struct mfc6_cache_cmp_arg { |
69 | struct in6_addr mf6c_mcastgrp; | |
70 | struct in6_addr mf6c_origin; | |
71 | }; | |
72 | ||
d94d9fee | 73 | struct mfc6_cache { |
87c418bf YM |
74 | struct rhlist_head mnode; |
75 | union { | |
76 | struct { | |
77 | struct in6_addr mf6c_mcastgrp; | |
78 | struct in6_addr mf6c_origin; | |
79 | }; | |
80 | struct mfc6_cache_cmp_arg cmparg; | |
81 | }; | |
7bc570c8 YH |
82 | mifi_t mf6c_parent; /* Source interface */ |
83 | int mfc_flags; /* Flags on line */ | |
84 | ||
85 | union { | |
86 | struct { | |
87 | unsigned long expires; | |
88 | struct sk_buff_head unresolved; /* Unresolved buffers */ | |
89 | } unres; | |
90 | struct { | |
91 | unsigned long last_assert; | |
92 | int minvif; | |
93 | int maxvif; | |
94 | unsigned long bytes; | |
95 | unsigned long pkt; | |
96 | unsigned long wrong_if; | |
43b9e127 | 97 | unsigned long lastuse; |
7bc570c8 YH |
98 | unsigned char ttls[MAXMIFS]; /* TTL thresholds */ |
99 | } res; | |
100 | } mfc_un; | |
87c418bf YM |
101 | struct list_head list; |
102 | struct rcu_head rcu; | |
7bc570c8 YH |
103 | }; |
104 | ||
105 | #define MFC_STATIC 1 | |
106 | #define MFC_NOTIFY 2 | |
107 | ||
7bc570c8 YH |
108 | #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ |
109 | ||
7bc570c8 | 110 | struct rtmsg; |
8229efda | 111 | extern int ip6mr_get_route(struct net *net, struct sk_buff *skb, |
fd61c6ba | 112 | struct rtmsg *rtm, u32 portid); |
7bc570c8 YH |
113 | |
114 | #ifdef CONFIG_IPV6_MROUTE | |
8571ab47 | 115 | bool mroute6_is_socket(struct net *net, struct sk_buff *skb); |
7bc570c8 YH |
116 | extern int ip6mr_sk_done(struct sock *sk); |
117 | #else | |
8571ab47 | 118 | static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb) |
d1db275d | 119 | { |
8571ab47 | 120 | return false; |
d1db275d PM |
121 | } |
122 | static inline int ip6mr_sk_done(struct sock *sk) | |
123 | { | |
124 | return 0; | |
125 | } | |
7bc570c8 YH |
126 | #endif |
127 | #endif |