vfs: fix return type of ioctl_file_dedupe_range
[linux-2.6-block.git] / include / linux / mroute.h
CommitLineData
1da177e4
LT
1#ifndef __LINUX_MROUTE_H
2#define __LINUX_MROUTE_H
3
1da177e4 4#include <linux/in.h>
7c19a3d2 5#include <linux/pim.h>
1da177e4 6#include <net/sock.h>
607ca46e 7#include <uapi/linux/mroute.h>
1da177e4 8
6a9fb947
PE
9#ifdef CONFIG_IP_MROUTE
10static inline int ip_mroute_opt(int opt)
11{
520191bb 12 return opt >= MRT_BASE && opt <= MRT_MAX;
6a9fb947 13}
6a9fb947 14
520191bb
NA
15int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
16int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
17int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
18int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
19int ip_mr_init(void);
e0835f8f 20#else
520191bb
NA
21static inline int ip_mroute_setsockopt(struct sock *sock, int optname,
22 char __user *optval, unsigned int optlen)
e0835f8f
YH
23{
24 return -ENOPROTOOPT;
25}
26
520191bb
NA
27static inline int ip_mroute_getsockopt(struct sock *sock, int optname,
28 char __user *optval, int __user *optlen)
e0835f8f
YH
29{
30 return -ENOPROTOOPT;
31}
32
520191bb 33static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
e0835f8f
YH
34{
35 return -ENOIOCTLCMD;
36}
37
38static inline int ip_mr_init(void)
39{
40 return 0;
41}
520191bb
NA
42
43static inline int ip_mroute_opt(int opt)
44{
45 return 0;
46}
e0835f8f 47#endif
1da177e4 48
d94d9fee 49struct vif_device {
1da177e4
LT
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 */
114c7844 56 __be32 local,remote; /* Addresses(remote for tunnels)*/
1da177e4
LT
57 int link; /* Physical interface index */
58};
59
60#define VIFF_STATIC 0x8000
61
5ea1f132
NA
62#define VIF_EXISTS(_mrt, _idx) ((_mrt)->vif_table[_idx].dev != NULL)
63#define MFC_LINES 64
64
65struct mr_table {
66 struct list_head list;
67 possible_net_t net;
68 u32 id;
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];
74 int maxvif;
75 atomic_t cache_resolve_queue_len;
76 bool mroute_do_assert;
77 bool mroute_do_pim;
78 int mroute_reg_vif_num;
79};
80
06bd6c03
NA
81/* mfc_flags:
82 * MFC_STATIC - the entry was added statically (not by a routing daemon)
83 */
84enum {
85 MFC_STATIC = BIT(0),
86};
87
d94d9fee 88struct mfc_cache {
862465f2 89 struct list_head list;
114c7844
AV
90 __be32 mfc_mcastgrp; /* Group the entry belongs to */
91 __be32 mfc_origin; /* Source of packet */
1da177e4
LT
92 vifi_t mfc_parent; /* Source interface */
93 int mfc_flags; /* Flags on line */
94
95 union {
96 struct {
97 unsigned long expires;
98 struct sk_buff_head unresolved; /* Unresolved buffers */
99 } unres;
100 struct {
101 unsigned long last_assert;
102 int minvif;
103 int maxvif;
104 unsigned long bytes;
105 unsigned long pkt;
106 unsigned long wrong_if;
43b9e127 107 unsigned long lastuse;
1da177e4
LT
108 unsigned char ttls[MAXVIFS]; /* TTL thresholds */
109 } res;
110 } mfc_un;
a8c9486b 111 struct rcu_head rcu;
1da177e4
LT
112};
113
1da177e4 114#ifdef __BIG_ENDIAN
114c7844 115#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
1da177e4 116#else
114c7844 117#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
520191bb 118#endif
1da177e4 119
1da177e4 120struct rtmsg;
520191bb
NA
121int ipmr_get_route(struct net *net, struct sk_buff *skb,
122 __be32 saddr, __be32 daddr,
123 struct rtmsg *rtm, int nowait);
1da177e4 124#endif