mroute6.h 2.7 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3 4 5
#ifndef __LINUX_MROUTE6_H
#define __LINUX_MROUTE6_H


6
#include <linux/pim.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 12 13 14

#ifdef CONFIG_IPV6_MROUTE
static inline int ip6_mroute_opt(int opt)
{
15
	return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
16 17 18 19 20 21 22 23 24 25
}
#else
static inline int ip6_mroute_opt(int opt)
{
	return 0;
}
#endif

struct sock;

26
#ifdef CONFIG_IPV6_MROUTE
27
extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
28 29 30
extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
extern int ip6_mr_input(struct sk_buff *skb);
extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
31
extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
W
Wang Chen 已提交
32 33
extern int ip6_mr_init(void);
extern void ip6_mr_cleanup(void);
34 35 36
#else
static inline
int ip6_mroute_setsockopt(struct sock *sock,
37
			  int optname, char __user *optval, unsigned int optlen)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
{
	return -ENOPROTOOPT;
}

static inline
int ip6_mroute_getsockopt(struct sock *sock,
			  int optname, char __user *optval, int __user *optlen)
{
	return -ENOPROTOOPT;
}

static inline
int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
{
	return -ENOIOCTLCMD;
}

static inline int ip6_mr_init(void)
{
	return 0;
}

static inline void ip6_mr_cleanup(void)
{
	return;
}
#endif
65 66 67

#define VIFF_STATIC 0x8000

68 69 70 71 72
struct mfc6_cache_cmp_arg {
	struct in6_addr mf6c_mcastgrp;
	struct in6_addr mf6c_origin;
};

E
Eric Dumazet 已提交
73
struct mfc6_cache {
74 75 76 77 78 79 80 81
	struct rhlist_head mnode;
	union {
		struct {
			struct in6_addr mf6c_mcastgrp;
			struct in6_addr mf6c_origin;
		};
		struct mfc6_cache_cmp_arg cmparg;
	};
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
	mifi_t mf6c_parent;			/* Source interface		*/
	int mfc_flags;				/* Flags on line		*/

	union {
		struct {
			unsigned long expires;
			struct sk_buff_head unresolved;	/* Unresolved buffers		*/
		} unres;
		struct {
			unsigned long last_assert;
			int minvif;
			int maxvif;
			unsigned long bytes;
			unsigned long pkt;
			unsigned long wrong_if;
97
			unsigned long lastuse;
98 99 100
			unsigned char ttls[MAXMIFS];	/* TTL thresholds		*/
		} res;
	} mfc_un;
101 102
	struct list_head list;
	struct rcu_head rcu;
103 104 105 106 107 108 109 110
};

#define MFC_STATIC		1
#define MFC_NOTIFY		2

#define MFC_ASSERT_THRESH (3*HZ)		/* Maximal freq. of asserts */

struct rtmsg;
111
extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
112
			   struct rtmsg *rtm, u32 portid);
113 114

#ifdef CONFIG_IPV6_MROUTE
Y
Yuval Mintz 已提交
115
bool mroute6_is_socket(struct net *net, struct sk_buff *skb);
116 117
extern int ip6mr_sk_done(struct sock *sk);
#else
Y
Yuval Mintz 已提交
118
static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb)
119
{
Y
Yuval Mintz 已提交
120
	return false;
121 122 123 124 125
}
static inline int ip6mr_sk_done(struct sock *sk)
{
	return 0;
}
126 127
#endif
#endif