@@ -74,64 +74,12 @@ static void nft_trans_destroy(struct nft_trans *trans)
74
74
kfree (trans );
75
75
}
76
76
77
- /* removal requests are queued in the commit_list, but not acted upon
78
- * until after all new rules are in place.
79
- *
80
- * Therefore, nf_register_net_hook(net, &nat_hook) runs before pending
81
- * nf_unregister_net_hook().
82
- *
83
- * nf_register_net_hook thus fails if a nat hook is already in place
84
- * even if the conflicting hook is about to be removed.
85
- *
86
- * If collision is detected, search commit_log for DELCHAIN matching
87
- * the new nat hooknum; if we find one collision is temporary:
88
- *
89
- * Either transaction is aborted (new/colliding hook is removed), or
90
- * transaction is committed (old hook is removed).
91
- */
92
- static bool nf_tables_allow_nat_conflict (const struct net * net ,
93
- const struct nf_hook_ops * ops )
94
- {
95
- const struct nft_trans * trans ;
96
- bool ret = false;
97
-
98
- if (!ops -> nat_hook )
99
- return false;
100
-
101
- list_for_each_entry (trans , & net -> nft .commit_list , list ) {
102
- const struct nf_hook_ops * pending_ops ;
103
- const struct nft_chain * pending ;
104
-
105
- if (trans -> msg_type != NFT_MSG_NEWCHAIN &&
106
- trans -> msg_type != NFT_MSG_DELCHAIN )
107
- continue ;
108
-
109
- pending = trans -> ctx .chain ;
110
- if (!nft_is_base_chain (pending ))
111
- continue ;
112
-
113
- pending_ops = & nft_base_chain (pending )-> ops ;
114
- if (pending_ops -> nat_hook &&
115
- pending_ops -> pf == ops -> pf &&
116
- pending_ops -> hooknum == ops -> hooknum ) {
117
- /* other hook registration already pending? */
118
- if (trans -> msg_type == NFT_MSG_NEWCHAIN )
119
- return false;
120
-
121
- ret = true;
122
- }
123
- }
124
-
125
- return ret ;
126
- }
127
-
128
77
static int nf_tables_register_hook (struct net * net ,
129
78
const struct nft_table * table ,
130
79
struct nft_chain * chain )
131
80
{
132
81
const struct nft_base_chain * basechain ;
133
- struct nf_hook_ops * ops ;
134
- int ret ;
82
+ const struct nf_hook_ops * ops ;
135
83
136
84
if (table -> flags & NFT_TABLE_F_DORMANT ||
137
85
!nft_is_base_chain (chain ))
@@ -143,14 +91,7 @@ static int nf_tables_register_hook(struct net *net,
143
91
if (basechain -> type -> ops_register )
144
92
return basechain -> type -> ops_register (net , ops );
145
93
146
- ret = nf_register_net_hook (net , ops );
147
- if (ret == - EBUSY && nf_tables_allow_nat_conflict (net , ops )) {
148
- ops -> nat_hook = false;
149
- ret = nf_register_net_hook (net , ops );
150
- ops -> nat_hook = true;
151
- }
152
-
153
- return ret ;
94
+ return nf_register_net_hook (net , ops );
154
95
}
155
96
156
97
static void nf_tables_unregister_hook (struct net * net ,
@@ -1418,9 +1359,6 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
1418
1359
ops -> hook = hook .type -> hooks [ops -> hooknum ];
1419
1360
ops -> dev = hook .dev ;
1420
1361
1421
- if (basechain -> type -> type == NFT_CHAIN_T_NAT )
1422
- ops -> nat_hook = true;
1423
-
1424
1362
chain -> flags |= NFT_BASE_CHAIN ;
1425
1363
basechain -> policy = policy ;
1426
1364
} else {
0 commit comments