2005-04-17 05:20:36 +07:00
|
|
|
#ifndef __LINUX_MROUTE_H
|
|
|
|
#define __LINUX_MROUTE_H
|
|
|
|
|
|
|
|
#include <linux/in.h>
|
2008-08-30 04:37:23 +07:00
|
|
|
#include <linux/pim.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <net/sock.h>
|
2012-10-13 16:46:48 +07:00
|
|
|
#include <uapi/linux/mroute.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2007-11-06 12:32:31 +07:00
|
|
|
#ifdef CONFIG_IP_MROUTE
|
|
|
|
static inline int ip_mroute_opt(int opt)
|
|
|
|
{
|
|
|
|
return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int ip_mroute_opt(int opt)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-07-03 14:51:22 +07:00
|
|
|
#ifdef CONFIG_IP_MROUTE
|
2009-10-01 06:12:20 +07:00
|
|
|
extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
|
2005-04-17 05:20:36 +07:00
|
|
|
extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
|
|
|
|
extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
2011-01-29 23:15:56 +07:00
|
|
|
extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
|
2008-07-03 11:13:36 +07:00
|
|
|
extern int ip_mr_init(void);
|
2008-07-03 14:51:22 +07:00
|
|
|
#else
|
|
|
|
static inline
|
|
|
|
int ip_mroute_setsockopt(struct sock *sock,
|
2009-10-01 06:12:20 +07:00
|
|
|
int optname, char __user *optval, unsigned int optlen)
|
2008-07-03 14:51:22 +07:00
|
|
|
{
|
|
|
|
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
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-11-05 00:50:58 +07:00
|
|
|
struct vif_device {
|
2005-04-17 05:20:36 +07:00
|
|
|
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 */
|
2006-09-28 08:39:29 +07:00
|
|
|
__be32 local,remote; /* Addresses(remote for tunnels)*/
|
2005-04-17 05:20:36 +07:00
|
|
|
int link; /* Physical interface index */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VIFF_STATIC 0x8000
|
|
|
|
|
2009-11-05 00:50:58 +07:00
|
|
|
struct mfc_cache {
|
2010-04-13 12:03:21 +07:00
|
|
|
struct list_head list;
|
2006-09-28 08:39:29 +07:00
|
|
|
__be32 mfc_mcastgrp; /* Group the entry belongs to */
|
|
|
|
__be32 mfc_origin; /* Source of packet */
|
2005-04-17 05:20:36 +07:00
|
|
|
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;
|
2010-10-01 23:15:08 +07:00
|
|
|
struct rcu_head rcu;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MFC_STATIC 1
|
|
|
|
#define MFC_NOTIFY 2
|
|
|
|
|
|
|
|
#define MFC_LINES 64
|
|
|
|
|
|
|
|
#ifdef __BIG_ENDIAN
|
2006-09-28 08:39:29 +07:00
|
|
|
#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
|
2005-04-17 05:20:36 +07:00
|
|
|
#else
|
2006-09-28 08:39:29 +07:00
|
|
|
#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
struct rtmsg;
|
2009-01-22 11:56:23 +07:00
|
|
|
extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
|
2011-05-05 02:18:54 +07:00
|
|
|
__be32 saddr, __be32 daddr,
|
2009-01-22 11:56:23 +07:00
|
|
|
struct rtmsg *rtm, int nowait);
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|