linux/include/linux/mroute.h
<<
>>
Prefs
   1#ifndef __LINUX_MROUTE_H
   2#define __LINUX_MROUTE_H
   3
   4#include <linux/in.h>
   5#include <linux/pim.h>
   6#include <net/sock.h>
   7#include <uapi/linux/mroute.h>
   8
   9#ifdef CONFIG_IP_MROUTE
  10static inline int ip_mroute_opt(int opt)
  11{
  12        return (opt >= MRT_BASE) && (opt <= MRT_MAX);
  13}
  14#else
  15static inline int ip_mroute_opt(int opt)
  16{
  17        return 0;
  18}
  19#endif
  20
  21#ifdef CONFIG_IP_MROUTE
  22extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
  23extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
  24extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
  25extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
  26extern int ip_mr_init(void);
  27#else
  28static inline
  29int ip_mroute_setsockopt(struct sock *sock,
  30                         int optname, char __user *optval, unsigned int optlen)
  31{
  32        return -ENOPROTOOPT;
  33}
  34
  35static inline
  36int ip_mroute_getsockopt(struct sock *sock,
  37                         int optname, char __user *optval, int __user *optlen)
  38{
  39        return -ENOPROTOOPT;
  40}
  41
  42static inline
  43int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
  44{
  45        return -ENOIOCTLCMD;
  46}
  47
  48static inline int ip_mr_init(void)
  49{
  50        return 0;
  51}
  52#endif
  53
  54struct vif_device {
  55        struct net_device       *dev;                   /* Device we are using */
  56        unsigned long   bytes_in,bytes_out;
  57        unsigned long   pkt_in,pkt_out;         /* Statistics                   */
  58        unsigned long   rate_limit;             /* Traffic shaping (NI)         */
  59        unsigned char   threshold;              /* TTL threshold                */
  60        unsigned short  flags;                  /* Control flags                */
  61        __be32          local,remote;           /* Addresses(remote for tunnels)*/
  62        int             link;                   /* Physical interface index     */
  63};
  64
  65#define VIFF_STATIC 0x8000
  66
  67struct mfc_cache {
  68        struct list_head list;
  69        __be32 mfc_mcastgrp;                    /* Group the entry belongs to   */
  70        __be32 mfc_origin;                      /* Source of packet             */
  71        vifi_t mfc_parent;                      /* Source interface             */
  72        int mfc_flags;                          /* Flags on line                */
  73
  74        union {
  75                struct {
  76                        unsigned long expires;
  77                        struct sk_buff_head unresolved; /* Unresolved buffers           */
  78                } unres;
  79                struct {
  80                        unsigned long last_assert;
  81                        int minvif;
  82                        int maxvif;
  83                        unsigned long bytes;
  84                        unsigned long pkt;
  85                        unsigned long wrong_if;
  86                        unsigned char ttls[MAXVIFS];    /* TTL thresholds               */
  87                } res;
  88        } mfc_un;
  89        struct rcu_head rcu;
  90};
  91
  92#define MFC_STATIC              1
  93#define MFC_NOTIFY              2
  94
  95#define MFC_LINES               64
  96
  97#ifdef __BIG_ENDIAN
  98#define MFC_HASH(a,b)   (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
  99#else
 100#define MFC_HASH(a,b)   ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
 101#endif          
 102
 103struct rtmsg;
 104extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
 105                          __be32 saddr, __be32 daddr,
 106                          struct rtmsg *rtm, int nowait);
 107#endif
 108