netfilter: nf_tables: get rid of per rule list_head for commits
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v3 1/4 netfilter: nf_tables: get rid of per rule list_head for commits
Get rid of the extra struct list_head per rule. With this patch, a temporary object is allocated to store the rule update information.
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v3: fix rule replacement case
include/net/netfilter/nf_tables.h | 15 +++++- net/netfilter/nf_tables_api.c | 100 +++++++++++++++++++++++++------------ 2 files changed, 82 insertions(+), 33 deletions(-)
include/net/netfilter/nf_tables.h +13 -2
@@ -321,7 +321,6 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)* struct nft_rule - nf_tables rule * * @list: used internally -* @dirty_list: this rule needs an update after new generation * @rcu_head: used internally for rcu * @handle: rule handle * @genmask: generation mask
@@ -330,7 +329,6 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)*/ struct nft_rule {struct list_head list; -struct list_head dirty_list;struct rcu_head rcu_head;u64 handle:46 , genmask:2,
@@ -339,6 +337,19 @@ struct nft_rule { __attribute__((aligned(__alignof__(struct nft_expr)))); }; +/** +* struct nft_rule_trans - nf_tables rule update in transaction +* +* @list: used internally +* @rule: rule that needs to be updated +* @family: family expressesed as AF_* +*/ +struct nft_rule_trans { +struct list_head list; +struct nft_rule *rule; +u8 family; +}; +static inline struct nft_expr *nft_expr_first (const struct nft_rule *rule) {return (struct nft_expr *)&rule->data[0 ];
net/netfilter/nf_tables_api.c +69 -31
207 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH v3 4/4 netfilter: nf_tables: all rule updates are transactional
This patch makes all rule updates transactional, this simplifies the ruleset update logic. Suggested by Patrick McHardy.
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v3: fix rule replacement case
include/uapi/linux/netfilter/nf_tables.h | 5 --- net/netfilter/nf_tables_api.c | 69 +++++++----------------------- 2 files changed, 16 insertions(+), 58 deletions(-)
include/uapi/linux/netfilter/nf_tables.h +0 -5
@@ -120,11 +120,6 @@ enum nft_chain_attributes { };#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) -enum { -NFT_RULE_F_COMMIT = (1 <<0 ), -NFT_RULE_F_MASK =NFT_RULE_F_COMMIT , -}; -/** * enum nft_rule_attributes - nf_tables rule netlink attributes *
net/netfilter/nf_tables_api.c +16 -53
121 lines not on this page · raw message
Signature · 1 line
1.7.10.4