1 #ifndef __LINUX_MROUTE_H
2 #define __LINUX_MROUTE_H
7 #include <uapi/linux/mroute.h>
9 #ifdef CONFIG_IP_MROUTE
10 static inline int ip_mroute_opt(int opt
)
12 return opt
>= MRT_BASE
&& opt
<= MRT_MAX
;
15 int ip_mroute_setsockopt(struct sock
*, int, char __user
*, unsigned int);
16 int ip_mroute_getsockopt(struct sock
*, int, char __user
*, int __user
*);
17 int ipmr_ioctl(struct sock
*sk
, int cmd
, void __user
*arg
);
18 int ipmr_compat_ioctl(struct sock
*sk
, unsigned int cmd
, void __user
*arg
);
21 static inline int ip_mroute_setsockopt(struct sock
*sock
, int optname
,
22 char __user
*optval
, unsigned int optlen
)
27 static inline int ip_mroute_getsockopt(struct sock
*sock
, int optname
,
28 char __user
*optval
, int __user
*optlen
)
33 static inline int ipmr_ioctl(struct sock
*sk
, int cmd
, void __user
*arg
)
38 static inline int ip_mr_init(void)
43 static inline int ip_mroute_opt(int opt
)
50 struct net_device
*dev
; /* Device we are using */
51 unsigned long bytes_in
,bytes_out
;
52 unsigned long pkt_in
,pkt_out
; /* Statistics */
53 unsigned long rate_limit
; /* Traffic shaping (NI) */
54 unsigned char threshold
; /* TTL threshold */
55 unsigned short flags
; /* Control flags */
56 __be32 local
,remote
; /* Addresses(remote for tunnels)*/
57 int link
; /* Physical interface index */
60 #define VIFF_STATIC 0x8000
62 #define VIF_EXISTS(_mrt, _idx) ((_mrt)->vif_table[_idx].dev != NULL)
66 struct list_head list
;
69 struct sock __rcu
*mroute_sk
;
70 struct timer_list ipmr_expire_timer
;
71 struct list_head mfc_unres_queue
;
72 struct list_head mfc_cache_array
[MFC_LINES
];
73 struct vif_device vif_table
[MAXVIFS
];
75 atomic_t cache_resolve_queue_len
;
76 bool mroute_do_assert
;
78 int mroute_reg_vif_num
;
82 * MFC_STATIC - the entry was added statically (not by a routing daemon)
89 struct list_head list
;
90 __be32 mfc_mcastgrp
; /* Group the entry belongs to */
91 __be32 mfc_origin
; /* Source of packet */
92 vifi_t mfc_parent
; /* Source interface */
93 int mfc_flags
; /* Flags on line */
97 unsigned long expires
;
98 struct sk_buff_head unresolved
; /* Unresolved buffers */
101 unsigned long last_assert
;
106 unsigned long wrong_if
;
107 unsigned char ttls
[MAXVIFS
]; /* TTL thresholds */
114 #define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
116 #define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
120 int ipmr_get_route(struct net
*net
, struct sk_buff
*skb
,
121 __be32 saddr
, __be32 daddr
,
122 struct rtmsg
*rtm
, int nowait
);