@@ -251,7 +251,7 @@ static void __nft_chain_trans_bind(const struct nft_ctx *ctx,
251
251
nft_trans_chain_bound (trans ) = bind ;
252
252
break ;
253
253
case NFT_MSG_NEWRULE :
254
- if (trans -> ctx . chain == chain )
254
+ if (nft_trans_rule_chain ( trans ) == chain )
255
255
nft_trans_rule_bound (trans ) = bind ;
256
256
break ;
257
257
}
@@ -541,6 +541,7 @@ static struct nft_trans *nft_trans_rule_add(struct nft_ctx *ctx, int msg_type,
541
541
ntohl (nla_get_be32 (ctx -> nla [NFTA_RULE_ID ]));
542
542
}
543
543
nft_trans_rule (trans ) = rule ;
544
+ nft_trans_rule_chain (trans ) = ctx -> chain ;
544
545
nft_trans_commit_list_add_tail (ctx -> net , trans );
545
546
546
547
return trans ;
@@ -4227,7 +4228,7 @@ static struct nft_rule *nft_rule_lookup_byid(const struct net *net,
4227
4228
4228
4229
list_for_each_entry (trans , & nft_net -> commit_list , list ) {
4229
4230
if (trans -> msg_type == NFT_MSG_NEWRULE &&
4230
- trans -> ctx . chain == chain &&
4231
+ nft_trans_rule_chain ( trans ) == chain &&
4231
4232
id == nft_trans_rule_id (trans ))
4232
4233
return nft_trans_rule (trans );
4233
4234
}
@@ -9684,7 +9685,7 @@ static void nf_tables_commit_chain_prepare_cancel(struct net *net)
9684
9685
list_for_each_entry_safe (trans , next , & nft_net -> commit_list , list ) {
9685
9686
if (trans -> msg_type == NFT_MSG_NEWRULE ||
9686
9687
trans -> msg_type == NFT_MSG_DELRULE ) {
9687
- struct nft_chain * chain = trans -> ctx . chain ;
9688
+ struct nft_chain * chain = nft_trans_rule_chain ( trans ) ;
9688
9689
9689
9690
kvfree (chain -> blob_next );
9690
9691
chain -> blob_next = NULL ;
@@ -10250,7 +10251,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
10250
10251
}
10251
10252
if (trans -> msg_type == NFT_MSG_NEWRULE ||
10252
10253
trans -> msg_type == NFT_MSG_DELRULE ) {
10253
- chain = trans -> ctx . chain ;
10254
+ chain = nft_trans_rule_chain ( trans ) ;
10254
10255
10255
10256
ret = nf_tables_commit_chain_prepare (net , chain );
10256
10257
if (ret < 0 ) {
@@ -10346,7 +10347,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
10346
10347
nf_tables_rule_notify (& trans -> ctx ,
10347
10348
nft_trans_rule (trans ),
10348
10349
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 )
10350
10351
nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
10351
10352
10352
10353
nft_trans_destroy (trans );
@@ -10361,7 +10362,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
10361
10362
nft_trans_rule (trans ),
10362
10363
NFT_TRANS_COMMIT );
10363
10364
10364
- if (trans -> ctx . chain -> flags & NFT_CHAIN_HW_OFFLOAD )
10365
+ if (nft_trans_rule_chain ( trans ) -> flags & NFT_CHAIN_HW_OFFLOAD )
10365
10366
nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
10366
10367
break ;
10367
10368
case NFT_MSG_NEWSET :
@@ -10645,20 +10646,20 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
10645
10646
nft_trans_destroy (trans );
10646
10647
break ;
10647
10648
}
10648
- nft_use_dec_restore (& trans -> ctx . chain -> use );
10649
+ nft_use_dec_restore (& nft_trans_rule_chain ( trans ) -> use );
10649
10650
list_del_rcu (& nft_trans_rule (trans )-> list );
10650
10651
nft_rule_expr_deactivate (& trans -> ctx ,
10651
10652
nft_trans_rule (trans ),
10652
10653
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 )
10654
10655
nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
10655
10656
break ;
10656
10657
case NFT_MSG_DELRULE :
10657
10658
case NFT_MSG_DESTROYRULE :
10658
- nft_use_inc_restore (& trans -> ctx . chain -> use );
10659
+ nft_use_inc_restore (& nft_trans_rule_chain ( trans ) -> use );
10659
10660
nft_clear (trans -> ctx .net , nft_trans_rule (trans ));
10660
10661
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 )
10662
10663
nft_flow_rule_destroy (nft_trans_flow_rule (trans ));
10663
10664
10664
10665
nft_trans_destroy (trans );
0 commit comments