]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef __LINUX_MROUTE_H |
3 | #define __LINUX_MROUTE_H | |
4 | ||
1da177e4 | 5 | #include <linux/in.h> |
7c19a3d2 | 6 | #include <linux/pim.h> |
478e4c2f | 7 | #include <net/fib_rules.h> |
4d65b948 | 8 | #include <net/fib_notifier.h> |
607ca46e | 9 | #include <uapi/linux/mroute.h> |
6853f21f | 10 | #include <linux/mroute_base.h> |
1da177e4 | 11 | |
6a9fb947 PE |
12 | #ifdef CONFIG_IP_MROUTE |
13 | static inline int ip_mroute_opt(int opt) | |
14 | { | |
520191bb | 15 | return opt >= MRT_BASE && opt <= MRT_MAX; |
6a9fb947 | 16 | } |
6a9fb947 | 17 | |
520191bb NA |
18 | int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); |
19 | int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); | |
20 | int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); | |
21 | int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); | |
22 | int ip_mr_init(void); | |
478e4c2f | 23 | bool ipmr_rule_default(const struct fib_rule *rule); |
e0835f8f | 24 | #else |
520191bb NA |
25 | static inline int ip_mroute_setsockopt(struct sock *sock, int optname, |
26 | char __user *optval, unsigned int optlen) | |
e0835f8f YH |
27 | { |
28 | return -ENOPROTOOPT; | |
29 | } | |
30 | ||
520191bb NA |
31 | static inline int ip_mroute_getsockopt(struct sock *sock, int optname, |
32 | char __user *optval, int __user *optlen) | |
e0835f8f YH |
33 | { |
34 | return -ENOPROTOOPT; | |
35 | } | |
36 | ||
520191bb | 37 | static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) |
e0835f8f YH |
38 | { |
39 | return -ENOIOCTLCMD; | |
40 | } | |
41 | ||
42 | static inline int ip_mr_init(void) | |
43 | { | |
44 | return 0; | |
45 | } | |
520191bb NA |
46 | |
47 | static inline int ip_mroute_opt(int opt) | |
48 | { | |
49 | return 0; | |
50 | } | |
478e4c2f YG |
51 | |
52 | static inline bool ipmr_rule_default(const struct fib_rule *rule) | |
53 | { | |
54 | return true; | |
55 | } | |
e0835f8f | 56 | #endif |
1da177e4 | 57 | |
1da177e4 LT |
58 | #define VIFF_STATIC 0x8000 |
59 | ||
8fb472c0 NA |
60 | struct mfc_cache_cmp_arg { |
61 | __be32 mfc_mcastgrp; | |
62 | __be32 mfc_origin; | |
63 | }; | |
64 | ||
65 | /** | |
66 | * struct mfc_cache - multicast routing entries | |
494fff56 | 67 | * @_c: Common multicast routing information; has to be first [for casting] |
8fb472c0 NA |
68 | * @mfc_mcastgrp: destination multicast group address |
69 | * @mfc_origin: source address | |
70 | * @cmparg: used for rhashtable comparisons | |
8fb472c0 | 71 | */ |
d94d9fee | 72 | struct mfc_cache { |
494fff56 | 73 | struct mr_mfc _c; |
8fb472c0 NA |
74 | union { |
75 | struct { | |
76 | __be32 mfc_mcastgrp; | |
77 | __be32 mfc_origin; | |
78 | }; | |
79 | struct mfc_cache_cmp_arg cmparg; | |
80 | }; | |
1da177e4 LT |
81 | }; |
82 | ||
1da177e4 | 83 | struct rtmsg; |
520191bb NA |
84 | int ipmr_get_route(struct net *net, struct sk_buff *skb, |
85 | __be32 saddr, __be32 daddr, | |
9f09eaea | 86 | struct rtmsg *rtm, u32 portid); |
1da177e4 | 87 | #endif |