mroute.h 2.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4
#ifndef __LINUX_MROUTE_H
#define __LINUX_MROUTE_H

#include <linux/in.h>
5
#include <linux/pim.h>
L
Linus Torvalds 已提交
6
#include <net/sock.h>
7
#include <uapi/linux/mroute.h>
L
Linus Torvalds 已提交
8

9 10 11
#ifdef CONFIG_IP_MROUTE
static inline int ip_mroute_opt(int opt)
{
12
	return (opt >= MRT_BASE) && (opt <= MRT_MAX);
13 14 15 16 17 18 19 20
}
#else
static inline int ip_mroute_opt(int opt)
{
	return 0;
}
#endif

21
#ifdef CONFIG_IP_MROUTE
22
extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
L
Linus Torvalds 已提交
23 24
extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
25
extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
W
Wang Chen 已提交
26
extern int ip_mr_init(void);
27 28 29
#else
static inline
int ip_mroute_setsockopt(struct sock *sock,
30
			 int optname, char __user *optval, unsigned int optlen)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
{
	return -ENOPROTOOPT;
}

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

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

static inline int ip_mr_init(void)
{
	return 0;
}
#endif
L
Linus Torvalds 已提交
53

E
Eric Dumazet 已提交
54
struct vif_device {
L
Linus Torvalds 已提交
55 56 57 58 59 60
	struct net_device 	*dev;			/* Device we are using */
	unsigned long	bytes_in,bytes_out;
	unsigned long	pkt_in,pkt_out;		/* Statistics 			*/
	unsigned long	rate_limit;		/* Traffic shaping (NI) 	*/
	unsigned char	threshold;		/* TTL threshold 		*/
	unsigned short	flags;			/* Control flags 		*/
A
Al Viro 已提交
61
	__be32		local,remote;		/* Addresses(remote for tunnels)*/
L
Linus Torvalds 已提交
62 63 64 65 66
	int		link;			/* Physical interface index	*/
};

#define VIFF_STATIC 0x8000

E
Eric Dumazet 已提交
67
struct mfc_cache {
68
	struct list_head list;
A
Al Viro 已提交
69 70
	__be32 mfc_mcastgrp;			/* Group the entry belongs to 	*/
	__be32 mfc_origin;			/* Source of packet 		*/
L
Linus Torvalds 已提交
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
	vifi_t mfc_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;
			unsigned char ttls[MAXVIFS];	/* TTL thresholds		*/
		} res;
	} mfc_un;
89
	struct rcu_head	rcu;
L
Linus Torvalds 已提交
90 91 92 93 94 95 96 97
};

#define MFC_STATIC		1
#define MFC_NOTIFY		2

#define MFC_LINES		64

#ifdef __BIG_ENDIAN
A
Al Viro 已提交
98
#define MFC_HASH(a,b)	(((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
L
Linus Torvalds 已提交
99
#else
A
Al Viro 已提交
100
#define MFC_HASH(a,b)	((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
L
Linus Torvalds 已提交
101 102 103
#endif		

struct rtmsg;
104
extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
105
			  __be32 saddr, __be32 daddr,
106
			  struct rtmsg *rtm, int nowait);
L
Linus Torvalds 已提交
107
#endif