]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/mroute.h
rhashtable: Mark internal/private inline functions as such
[mirror_ubuntu-bionic-kernel.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{
bbb923a4 12 return (opt >= MRT_BASE) && (opt <= MRT_MAX);
6a9fb947
PE
13}
14#else
15static inline int ip_mroute_opt(int opt)
16{
17 return 0;
18}
19#endif
20
e0835f8f 21#ifdef CONFIG_IP_MROUTE
b7058842 22extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
1da177e4
LT
23extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
24extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
709b46e8 25extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
03d2f897 26extern int ip_mr_init(void);
e0835f8f
YH
27#else
28static inline
29int ip_mroute_setsockopt(struct sock *sock,
b7058842 30 int optname, char __user *optval, unsigned int optlen)
e0835f8f
YH
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
1da177e4 53
d94d9fee 54struct vif_device {
1da177e4
LT
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 */
114c7844 61 __be32 local,remote; /* Addresses(remote for tunnels)*/
1da177e4
LT
62 int link; /* Physical interface index */
63};
64
65#define VIFF_STATIC 0x8000
66
d94d9fee 67struct mfc_cache {
862465f2 68 struct list_head list;
114c7844
AV
69 __be32 mfc_mcastgrp; /* Group the entry belongs to */
70 __be32 mfc_origin; /* Source of packet */
1da177e4
LT
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;
a8c9486b 89 struct rcu_head rcu;
1da177e4
LT
90};
91
92#define MFC_STATIC 1
93#define MFC_NOTIFY 2
94
95#define MFC_LINES 64
96
97#ifdef __BIG_ENDIAN
114c7844 98#define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1))
1da177e4 99#else
114c7844 100#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
1da177e4
LT
101#endif
102
1da177e4 103struct rtmsg;
4feb88e5 104extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
9a1b9496 105 __be32 saddr, __be32 daddr,
4feb88e5 106 struct rtmsg *rtm, int nowait);
1da177e4 107#endif