1 #ifndef __LINUX_MROUTE_H
2 #define __LINUX_MROUTE_H
6 #include <linux/rhashtable.h>
8 #include <uapi/linux/mroute.h>
10 #ifdef CONFIG_IP_MROUTE
11 static inline int ip_mroute_opt(int opt
)
13 return opt
>= MRT_BASE
&& opt
<= MRT_MAX
;
16 int ip_mroute_setsockopt(struct sock
*, int, char __user
*, unsigned int);
17 int ip_mroute_getsockopt(struct sock
*, int, char __user
*, int __user
*);
18 int ipmr_ioctl(struct sock
*sk
, int cmd
, void __user
*arg
);
19 int ipmr_compat_ioctl(struct sock
*sk
, unsigned int cmd
, void __user
*arg
);
22 static inline int ip_mroute_setsockopt(struct sock
*sock
, int optname
,
23 char __user
*optval
, unsigned int optlen
)
28 static inline int ip_mroute_getsockopt(struct sock
*sock
, int optname
,
29 char __user
*optval
, int __user
*optlen
)
34 static inline int ipmr_ioctl(struct sock
*sk
, int cmd
, void __user
*arg
)
39 static inline int ip_mr_init(void)
44 static inline int ip_mroute_opt(int opt
)
51 struct net_device
*dev
; /* Device we are using */
52 unsigned long bytes_in
,bytes_out
;
53 unsigned long pkt_in
,pkt_out
; /* Statistics */
54 unsigned long rate_limit
; /* Traffic shaping (NI) */
55 unsigned char threshold
; /* TTL threshold */
56 unsigned short flags
; /* Control flags */
57 __be32 local
,remote
; /* Addresses(remote for tunnels)*/
58 int link
; /* Physical interface index */
61 #define VIFF_STATIC 0x8000
63 #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 vif_device vif_table
[MAXVIFS
];
73 struct rhltable mfc_hash
;
74 struct list_head mfc_cache_list
;
76 atomic_t cache_resolve_queue_len
;
77 bool mroute_do_assert
;
79 int mroute_reg_vif_num
;
83 * MFC_STATIC - the entry was added statically (not by a routing daemon)
89 struct mfc_cache_cmp_arg
{
95 * struct mfc_cache - multicast routing entries
96 * @mnode: rhashtable list
97 * @mfc_mcastgrp: destination multicast group address
98 * @mfc_origin: source address
99 * @cmparg: used for rhashtable comparisons
100 * @mfc_parent: source interface (iif)
101 * @mfc_flags: entry flags
102 * @expires: unresolved entry expire time
103 * @unresolved: unresolved cached skbs
104 * @last_assert: time of last assert
105 * @minvif: minimum VIF id
106 * @maxvif: maximum VIF id
107 * @bytes: bytes that have passed for this entry
108 * @pkt: packets that have passed for this entry
109 * @wrong_if: number of wrong source interface hits
110 * @lastuse: time of last use of the group (traffic or update)
111 * @ttls: OIF TTL threshold array
112 * @list: global entry list
113 * @rcu: used for entry destruction
116 struct rhlist_head mnode
;
122 struct mfc_cache_cmp_arg cmparg
;
129 unsigned long expires
;
130 struct sk_buff_head unresolved
;
133 unsigned long last_assert
;
138 unsigned long wrong_if
;
139 unsigned long lastuse
;
140 unsigned char ttls
[MAXVIFS
];
143 struct list_head list
;
148 int ipmr_get_route(struct net
*net
, struct sk_buff
*skb
,
149 __be32 saddr
, __be32 daddr
,
150 struct rtmsg
*rtm
, u32 portid
);