Skip to content

Commit b9c04ae

Browse files
committed
netfilter: nf_tables: add nft_expr_type_request_module()
This helper function makes sure the family specific extension is loaded. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2a3a93e commit b9c04ae

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,19 @@ static const struct nft_expr_type *__nft_expr_type_get(u8 family,
20192019
return NULL;
20202020
}
20212021

2022+
#ifdef CONFIG_MODULES
2023+
static int nft_expr_type_request_module(struct net *net, u8 family,
2024+
struct nlattr *nla)
2025+
{
2026+
nft_request_module(net, "nft-expr-%u-%.*s", family,
2027+
nla_len(nla), (char *)nla_data(nla));
2028+
if (__nft_expr_type_get(family, nla))
2029+
return -EAGAIN;
2030+
2031+
return 0;
2032+
}
2033+
#endif
2034+
20222035
static const struct nft_expr_type *nft_expr_type_get(struct net *net,
20232036
u8 family,
20242037
struct nlattr *nla)
@@ -2035,9 +2048,7 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net,
20352048
lockdep_nfnl_nft_mutex_not_held();
20362049
#ifdef CONFIG_MODULES
20372050
if (type == NULL) {
2038-
nft_request_module(net, "nft-expr-%u-%.*s", family,
2039-
nla_len(nla), (char *)nla_data(nla));
2040-
if (__nft_expr_type_get(family, nla))
2051+
if (nft_expr_type_request_module(net, family, nla) == -EAGAIN)
20412052
return ERR_PTR(-EAGAIN);
20422053

20432054
nft_request_module(net, "nft-expr-%.*s",

0 commit comments

Comments
 (0)