netfilter: nf_tables: bogus EOPNOTSUPP on basechain update
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/2 netfilter: nf_tables: bogus EOPNOTSUPP on basechain update
Userspace never includes the NFT_BASE_CHAIN flag, this flag is inferred from the NFTA_CHAIN_HOOK atribute. The chain update path does not allow to update flags at this stage, the existing sanity check bogusly hits EOPNOTSUPP in the basechain case if the offload flag is set on.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -2177,6 +2177,7 @@ static int nf_tables_newchain(struct net *net, struct sock *nlsk,if (nlh->nlmsg_flags &NLM_F_REPLACE )return -EOPNOTSUPP ; + flags |= chain->flags &NFT_BASE_CHAIN ;return nf_tables_updchain (&ctx, genmask, policy, flags); }
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 2/2 netfilter: nf_tables_offload: skip EBUSY on chain update
Do not try to bind a chain again if it exists, otherwise the driver returns EBUSY.
Fixes c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nf_tables_offload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_offload.c +2 -1
@@ -401,7 +401,8 @@ int nft_flow_rule_offload_commit(struct net *net)switch (trans->msg_type) {case NFT_MSG_NEWCHAIN : -if (!(trans->ctx.chain->flags &NFT_CHAIN_HW_OFFLOAD )) +if (!(trans->ctx.chain->flags &NFT_CHAIN_HW_OFFLOAD ) || +nft_trans_chain_update (trans))continue ; policy =nft_trans_chain_policy (trans);
Signature · 1 line
2.11.0