@@ -251,7 +251,7 @@ static void __nft_chain_trans_bind(const struct nft_ctx *ctx,
251251 nft_trans_chain_bound (trans ) = bind ;
252252 break ;
253253 case NFT_MSG_NEWRULE :
254- if (trans -> ctx . chain == chain )
254+ if (nft_trans_rule_chain ( trans ) == chain )
255255 nft_trans_rule_bound (trans ) = bind ;
256256 break ;
257257 }
@@ -541,6 +541,7 @@ static struct nft_trans *nft_trans_rule_add(struct nft_ctx *ctx, int msg_type,
541541 ntohl (nla_get_be32 (ctx -> nla [NFTA_RULE_ID ]));
542542 }
543543 nft_trans_rule (trans ) = rule ;
544+ nft_trans_rule_chain (trans ) = ctx -> chain ;
544545 nft_trans_commit_list_add_tail (ctx -> net , trans );
545546
546547 return trans ;
@@ -4227,7 +4228,7 @@ static struct nft_rule *nft_rule_lookup_byid(const struct net *net,
42274228
42284229 list_for_each_entry (trans , & nft_net -> commit_list , list ) {
42294230 if (trans -> msg_type == NFT_MSG_NEWRULE &&
4230- trans -> ctx . chain == chain &&
4231+ nft_trans_rule_chain ( trans ) == chain &&
42314232 id == nft_trans_rule_id (trans ))
42324233 return nft_trans_rule (trans );
42334234 }
@@ -9684,7 +9685,7 @@ static void nf_tables_commit_chain_prepare_cancel(struct net *net)
96849685 list_for_each_entry_safe (trans , next , & nft_net -> commit_list , list ) {
96859686 if (trans -> msg_type == NFT_MSG_NEWRULE ||
96869687 trans -> msg_type == NFT_MSG_DELRULE ) {
9687- struct nft_chain * chain = trans -> ctx . chain ;
9688+ struct nft_chain * chain = nft_trans_rule_chain ( trans ) ;
96889689
96899690 kvfree (chain -> blob_next );
96909691 chain -> blob_next = NULL ;
@@ -10250,7 +10251,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
1025010251 }
1025110252 if (trans -> msg_type == NFT_MSG_NEWRULE ||
1025210253 trans -> msg_type == NFT_MSG_DELRULE ) {
10253- chain = trans -> ctx . chain ;
10254+ chain = nft_trans_rule_chain ( trans ) ;
1025410255
1025510256 ret = nf_tables_commit_chain_prepare (net , chain );
1025610257 if (ret < 0 ) {
@@ -10346,7 +10347,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
1034610347 nf_tables_rule_notify (& trans -> ctx ,
1034710348 nft_trans_rule (trans ),
1034810349 NFT_MSG_NEWRULE );
10349- if (trans -> ctx . chain -> flags & NFT_CHAIN_HW_OFFLOAD )
10350+ if (nft_trans_rule_chain ( trans ) -> flags & NFT_CHAIN_HW_OFFLOAD )
1035010351 nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
1035110352
1035210353 nft_trans_destroy (trans );
@@ -10361,7 +10362,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
1036110362 nft_trans_rule (trans ),
1036210363 NFT_TRANS_COMMIT );
1036310364
10364- if (trans -> ctx . chain -> flags & NFT_CHAIN_HW_OFFLOAD )
10365+ if (nft_trans_rule_chain ( trans ) -> flags & NFT_CHAIN_HW_OFFLOAD )
1036510366 nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
1036610367 break ;
1036710368 case NFT_MSG_NEWSET :
@@ -10645,20 +10646,20 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
1064510646 nft_trans_destroy (trans );
1064610647 break ;
1064710648 }
10648- nft_use_dec_restore (& trans -> ctx . chain -> use );
10649+ nft_use_dec_restore (& nft_trans_rule_chain ( trans ) -> use );
1064910650 list_del_rcu (& nft_trans_rule (trans )-> list );
1065010651 nft_rule_expr_deactivate (& trans -> ctx ,
1065110652 nft_trans_rule (trans ),
1065210653 NFT_TRANS_ABORT );
10653- if (trans -> ctx . chain -> flags & NFT_CHAIN_HW_OFFLOAD )
10654+ if (nft_trans_rule_chain ( trans ) -> flags & NFT_CHAIN_HW_OFFLOAD )
1065410655 nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
1065510656 break ;
1065610657 case NFT_MSG_DELRULE :
1065710658 case NFT_MSG_DESTROYRULE :
10658- nft_use_inc_restore (& trans -> ctx . chain -> use );
10659+ nft_use_inc_restore (& nft_trans_rule_chain ( trans ) -> use );
1065910660 nft_clear (trans -> ctx .net , nft_trans_rule (trans ));
1066010661 nft_rule_expr_activate (& trans -> ctx , nft_trans_rule (trans ));
10661- if (trans -> ctx . chain -> flags & NFT_CHAIN_HW_OFFLOAD )
10662+ if (nft_trans_rule_chain ( trans ) -> flags & NFT_CHAIN_HW_OFFLOAD )
1066210663 nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
1066310664
1066410665 nft_trans_destroy (trans );
0 commit comments