Browse Source

netfilter: nf_tables: Stack expression type depending on their family

To ensure family tight expression gets selected in priority to family
agnostic ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka 11 years ago
parent
commit
758dbcecf1
1 changed files with 4 additions and 1 deletions
  1. 4 1
      net/netfilter/nf_tables_api.c

+ 4 - 1
net/netfilter/nf_tables_api.c

@@ -1093,7 +1093,10 @@ static void nft_ctx_init(struct nft_ctx *ctx,
 int nft_register_expr(struct nft_expr_type *type)
 int nft_register_expr(struct nft_expr_type *type)
 {
 {
 	nfnl_lock(NFNL_SUBSYS_NFTABLES);
 	nfnl_lock(NFNL_SUBSYS_NFTABLES);
-	list_add_tail(&type->list, &nf_tables_expressions);
+	if (type->family == NFPROTO_UNSPEC)
+		list_add_tail(&type->list, &nf_tables_expressions);
+	else
+		list_add(&type->list, &nf_tables_expressions);
 	nfnl_unlock(NFNL_SUBSYS_NFTABLES);
 	nfnl_unlock(NFNL_SUBSYS_NFTABLES);
 	return 0;
 	return 0;
 }
 }