Blame view
include/net/fib_rules.h
2.99 KB
14c0b97dd [NET]: Protocol I... |
1 2 3 4 |
#ifndef __NET_FIB_RULES_H #define __NET_FIB_RULES_H #include <linux/types.h> |
5a0e3ad6a include cleanup: ... |
5 |
#include <linux/slab.h> |
14c0b97dd [NET]: Protocol I... |
6 7 8 |
#include <linux/netdevice.h> #include <linux/fib_rules.h> #include <net/flow.h> |
9d9e6a581 [NET] rules: Use ... |
9 |
#include <net/rtnetlink.h> |
14c0b97dd [NET]: Protocol I... |
10 |
|
fd2c3ef76 net: cleanup incl... |
11 |
struct fib_rule { |
14c0b97dd [NET]: Protocol I... |
12 13 |
struct list_head list; atomic_t refcnt; |
491deb24b net 02/05: fib_ru... |
14 |
int iifindex; |
1b038a5e6 net 03/05: fib_ru... |
15 |
int oifindex; |
b8964ed9f [NET] rules: Prot... |
16 17 |
u32 mark; u32 mark_mask; |
14c0b97dd [NET]: Protocol I... |
18 19 20 21 |
u32 pref; u32 flags; u32 table; u8 action; |
0947c9fe5 [NET] fib_rules: ... |
22 |
u32 target; |
7a2b03c51 fib_rules: __rcu ... |
23 |
struct fib_rule __rcu *ctarget; |
491deb24b net 02/05: fib_ru... |
24 |
char iifname[IFNAMSIZ]; |
1b038a5e6 net 03/05: fib_ru... |
25 |
char oifname[IFNAMSIZ]; |
14c0b97dd [NET]: Protocol I... |
26 |
struct rcu_head rcu; |
51314a17b [NETNS]: Process ... |
27 |
struct net * fr_net; |
14c0b97dd [NET]: Protocol I... |
28 |
}; |
fd2c3ef76 net: cleanup incl... |
29 |
struct fib_lookup_arg { |
14c0b97dd [NET]: Protocol I... |
30 31 32 |
void *lookup_ptr; void *result; struct fib_rule *rule; |
ebc0ffae5 fib: RCU conversi... |
33 34 |
int flags; #define FIB_LOOKUP_NOREF 1 |
14c0b97dd [NET]: Protocol I... |
35 |
}; |
fd2c3ef76 net: cleanup incl... |
36 |
struct fib_rules_ops { |
14c0b97dd [NET]: Protocol I... |
37 38 39 |
int family; struct list_head list; int rule_size; |
e1701c68c [NET]: Fix fib_ru... |
40 |
int addr_size; |
0947c9fe5 [NET] fib_rules: ... |
41 42 |
int unresolved_rules; int nr_goto_rules; |
14c0b97dd [NET]: Protocol I... |
43 44 45 46 47 48 49 50 |
int (*action)(struct fib_rule *, struct flowi *, int, struct fib_lookup_arg *); int (*match)(struct fib_rule *, struct flowi *, int); int (*configure)(struct fib_rule *, struct sk_buff *, |
14c0b97dd [NET]: Protocol I... |
51 52 53 54 55 56 |
struct fib_rule_hdr *, struct nlattr **); int (*compare)(struct fib_rule *, struct fib_rule_hdr *, struct nlattr **); int (*fill)(struct fib_rule *, struct sk_buff *, |
14c0b97dd [NET]: Protocol I... |
57 |
struct fib_rule_hdr *); |
868d13ac8 [NETNS]: Pass fib... |
58 |
u32 (*default_pref)(struct fib_rules_ops *ops); |
339bf98ff [NETLINK]: Do pre... |
59 |
size_t (*nlmsg_payload)(struct fib_rule *); |
14c0b97dd [NET]: Protocol I... |
60 |
|
73417f617 [NET] fib_rules: ... |
61 62 |
/* Called after modifications to the rules set, must flush * the route cache if one exists. */ |
ae299fc05 net: add fib_rule... |
63 |
void (*flush_cache)(struct fib_rules_ops *ops); |
73417f617 [NET] fib_rules: ... |
64 |
|
14c0b97dd [NET]: Protocol I... |
65 |
int nlgroup; |
ef7c79ed6 [NETLINK]: Mark n... |
66 |
const struct nla_policy *policy; |
76c72d4f4 [IPV4/IPV6/DECNET... |
67 |
struct list_head rules_list; |
14c0b97dd [NET]: Protocol I... |
68 |
struct module *owner; |
035923833 [FIB]: Add netns ... |
69 |
struct net *fro_net; |
e9c5158ac net: Allow fib_ru... |
70 |
struct rcu_head rcu; |
14c0b97dd [NET]: Protocol I... |
71 |
}; |
1f6c9557e [NET] rules: Shar... |
72 |
#define FRA_GENERIC_POLICY \ |
491deb24b net 02/05: fib_ru... |
73 |
[FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ |
1b038a5e6 net 03/05: fib_ru... |
74 |
[FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ |
1f6c9557e [NET] rules: Shar... |
75 76 77 |
[FRA_PRIORITY] = { .type = NLA_U32 }, \ [FRA_FWMARK] = { .type = NLA_U32 }, \ [FRA_FWMASK] = { .type = NLA_U32 }, \ |
0947c9fe5 [NET] fib_rules: ... |
78 79 |
[FRA_TABLE] = { .type = NLA_U32 }, \ [FRA_GOTO] = { .type = NLA_U32 } |
1f6c9557e [NET] rules: Shar... |
80 |
|
14c0b97dd [NET]: Protocol I... |
81 82 83 84 85 86 87 88 |
static inline void fib_rule_get(struct fib_rule *rule) { atomic_inc(&rule->refcnt); } static inline void fib_rule_put_rcu(struct rcu_head *head) { struct fib_rule *rule = container_of(head, struct fib_rule, rcu); |
3661a9108 [NETNS]: Add netn... |
89 |
release_net(rule->fr_net); |
14c0b97dd [NET]: Protocol I... |
90 91 92 93 94 95 96 97 |
kfree(rule); } static inline void fib_rule_put(struct fib_rule *rule) { if (atomic_dec_and_test(&rule->refcnt)) call_rcu(&rule->rcu, fib_rule_put_rcu); } |
9e762a4a8 [NET]: Introduce ... |
98 99 100 101 102 103 |
static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) { if (nla[FRA_TABLE]) return nla_get_u32(nla[FRA_TABLE]); return frh->table; } |
3d0c9c4eb net: fib_rules: m... |
104 |
extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); |
9e3a54878 [NETNS]: FIB rule... |
105 |
extern void fib_rules_unregister(struct fib_rules_ops *); |
14c0b97dd [NET]: Protocol I... |
106 107 108 109 |
extern int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags, struct fib_lookup_arg *); |
2994c6386 [INET]: Small pos... |
110 111 112 |
extern int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table, u32 flags); |
d8a566bea net: fib_rules: c... |
113 |
extern u32 fib_default_rule_pref(struct fib_rules_ops *ops); |
14c0b97dd [NET]: Protocol I... |
114 |
#endif |