diff options
author | Patrick McHardy <kaber@trash.net> | 2015-04-10 21:27:31 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-04-13 11:17:07 -0400 |
commit | a55e22e92f1a31018e6dc8fce35380900f022c24 (patch) | |
tree | 6acac379a7a836efbae5aa2b0bac292b953f0db4 /include/net | |
parent | d07db9884a5fba8c8020166c86183c79a18d066a (diff) |
netfilter: nf_tables: get rid of NFT_REG_VERDICT usage
Replace the array of registers passed to expressions by a struct nft_regs,
containing the verdict as a seperate member, which aliases to the
NFT_REG_VERDICT register.
This is needed to seperate the verdict from the data registers completely,
so their size can be changed.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/netfilter/nf_tables.h | 32 | ||||
-rw-r--r-- | include/net/netfilter/nft_meta.h | 4 |
2 files changed, 31 insertions, 5 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 9cc3d55d8fa1..79582d0b043e 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -36,6 +36,17 @@ static inline void nft_set_pktinfo(struct nft_pktinfo *pkt, | |||
36 | pkt->xt.family = ops->pf; | 36 | pkt->xt.family = ops->pf; |
37 | } | 37 | } |
38 | 38 | ||
39 | /** | ||
40 | * struct nft_verdict - nf_tables verdict | ||
41 | * | ||
42 | * @code: nf_tables/netfilter verdict code | ||
43 | * @chain: destination chain for NFT_JUMP/NFT_GOTO | ||
44 | */ | ||
45 | struct nft_verdict { | ||
46 | u32 code; | ||
47 | struct nft_chain *chain; | ||
48 | }; | ||
49 | |||
39 | struct nft_data { | 50 | struct nft_data { |
40 | union { | 51 | union { |
41 | u32 data[4]; | 52 | u32 data[4]; |
@@ -46,6 +57,21 @@ struct nft_data { | |||
46 | }; | 57 | }; |
47 | } __attribute__((aligned(__alignof__(u64)))); | 58 | } __attribute__((aligned(__alignof__(u64)))); |
48 | 59 | ||
60 | /** | ||
61 | * struct nft_regs - nf_tables register set | ||
62 | * | ||
63 | * @data: data registers | ||
64 | * @verdict: verdict register | ||
65 | * | ||
66 | * The first four data registers alias to the verdict register. | ||
67 | */ | ||
68 | struct nft_regs { | ||
69 | union { | ||
70 | struct nft_data data[NFT_REG_MAX + 1]; | ||
71 | struct nft_verdict verdict; | ||
72 | }; | ||
73 | }; | ||
74 | |||
49 | static inline int nft_data_cmp(const struct nft_data *d1, | 75 | static inline int nft_data_cmp(const struct nft_data *d1, |
50 | const struct nft_data *d2, | 76 | const struct nft_data *d2, |
51 | unsigned int len) | 77 | unsigned int len) |
@@ -221,9 +247,9 @@ struct nft_set_ops { | |||
221 | const struct nft_data *key, | 247 | const struct nft_data *key, |
222 | void *(*new)(struct nft_set *, | 248 | void *(*new)(struct nft_set *, |
223 | const struct nft_expr *, | 249 | const struct nft_expr *, |
224 | struct nft_data []), | 250 | struct nft_regs *), |
225 | const struct nft_expr *expr, | 251 | const struct nft_expr *expr, |
226 | struct nft_data data[], | 252 | struct nft_regs *regs, |
227 | const struct nft_set_ext **ext); | 253 | const struct nft_set_ext **ext); |
228 | 254 | ||
229 | int (*insert)(const struct nft_set *set, | 255 | int (*insert)(const struct nft_set *set, |
@@ -583,7 +609,7 @@ struct nft_expr_type { | |||
583 | struct nft_expr; | 609 | struct nft_expr; |
584 | struct nft_expr_ops { | 610 | struct nft_expr_ops { |
585 | void (*eval)(const struct nft_expr *expr, | 611 | void (*eval)(const struct nft_expr *expr, |
586 | struct nft_data data[NFT_REG_MAX + 1], | 612 | struct nft_regs *regs, |
587 | const struct nft_pktinfo *pkt); | 613 | const struct nft_pktinfo *pkt); |
588 | unsigned int size; | 614 | unsigned int size; |
589 | 615 | ||
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h index 0ee47c3e2e31..711887a09e91 100644 --- a/include/net/netfilter/nft_meta.h +++ b/include/net/netfilter/nft_meta.h | |||
@@ -26,11 +26,11 @@ int nft_meta_set_dump(struct sk_buff *skb, | |||
26 | const struct nft_expr *expr); | 26 | const struct nft_expr *expr); |
27 | 27 | ||
28 | void nft_meta_get_eval(const struct nft_expr *expr, | 28 | void nft_meta_get_eval(const struct nft_expr *expr, |
29 | struct nft_data data[NFT_REG_MAX + 1], | 29 | struct nft_regs *regs, |
30 | const struct nft_pktinfo *pkt); | 30 | const struct nft_pktinfo *pkt); |
31 | 31 | ||
32 | void nft_meta_set_eval(const struct nft_expr *expr, | 32 | void nft_meta_set_eval(const struct nft_expr *expr, |
33 | struct nft_data data[NFT_REG_MAX + 1], | 33 | struct nft_regs *regs, |
34 | const struct nft_pktinfo *pkt); | 34 | const struct nft_pktinfo *pkt); |
35 | 35 | ||
36 | #endif | 36 | #endif |