Skip to contentSkip to conversation

netfilter: fix unmet dependencies in NETFILTER_XT_TARGET_REDIRECT

PATCH New Pablo Neira Ayuso 1 participant 2 messages Nov 12, 2014

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/2 netfilter: fix unmet dependencies in NETFILTER_XT_TARGET_REDIRECT

warning: (NETFILTER_XT_TARGET_REDIRECT) selects NF_NAT_REDIRECT_IPV4 which has unmet direct dependencies (NET && INET && NETFILTER && NF_NAT_IPV4)

warning: (NETFILTER_XT_TARGET_REDIRECT) selects NF_NAT_REDIRECT_IPV6 which has unmet direct dependencies (NET && INET && IPV6 && NETFILTER && NF_NAT_IPV6)

Fixes 8b13edd ("netfilter: refactor NAT redirect IPv4 to use it from nf_tables")
Fixes 9de920e ("netfilter: refactor NAT redirect IPv6 code to use it from nf_tables")
---
 net/netfilter/Kconfig |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/Kconfig +2 -2
index 373486a..57f15a9 100644
@@ -844,8 +844,8 @@ config NETFILTER_XT_TARGET_RATEEST
 config NETFILTER_XT_TARGET_REDIRECT
 	tristate "REDIRECT target support"
 	depends on NF_NAT
-	select NF_NAT_REDIRECT_IPV4
-	select NF_NAT_REDIRECT_IPV6 if IP6_NF_IPTABLES
+	select NF_NAT_REDIRECT_IPV4 if NF_NAT_IPV4
+	select NF_NAT_REDIRECT_IPV6 if NF_NAT_IPV6
 	---help---
 	REDIRECT is a special case of NAT: all incoming connections are
 	mapped onto the incoming interface's address, causing the packets to
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw

PATCH 2/2 netfilter: nft_redir: fix sparse warnings

Quoted 1 line
Quoted 1 line

net/netfilter/nft_redir.c:39:26: sparse: incorrect type in assignment (different base types)

net/netfilter/nft_redir.c:39:26: expected unsigned int [unsigned] [usertype] nla_be32
net/netfilter/nft_redir.c:39:26: got restricted __be32

Quoted 7 lines
Quoted 7 lines

net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:46:34: sparse: incorrect type in assignment (different base types)

net/netfilter/nft_redir.c:46:34: expected unsigned int [unsigned] [usertype] nla_be32
net/netfilter/nft_redir.c:46:34: got restricted __be32

Quoted 6 lines
Quoted 6 lines

net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32 net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32

Fixes e9105f1 ("netfilter: nf_tables: add new expression nft_redir")
---
 net/netfilter/nft_redir.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
net/netfilter/nft_redir.c +6 -5
index e27b4e3..9e8093f 100644
@@ -28,7 +28,6 @@ int nft_redir_init(const struct nft_ctx *ctx,
 		   const struct nlattr * const tb[])
 {
 	struct nft_redir *priv = nft_expr_priv(expr);
-	u32 nla_be32;
 	int err;
 
 	err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT);
@@ -36,15 +35,17 @@ int nft_redir_init(const struct nft_ctx *ctx,
 		return err;
 
 	if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
-		nla_be32 = nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MIN]);
-		priv->sreg_proto_min = ntohl(nla_be32);
+		priv->sreg_proto_min =
+			ntohl(nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MIN]));
+
 		err = nft_validate_input_register(priv->sreg_proto_min);
 		if (err < 0)
 			return err;
 
 		if (tb[NFTA_REDIR_REG_PROTO_MAX]) {
-			nla_be32 = nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MAX]);
-			priv->sreg_proto_max = ntohl(nla_be32);
+			priv->sreg_proto_max =
+				ntohl(nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MAX]));
+
 			err = nft_validate_input_register(priv->sreg_proto_max);
 			if (err < 0)
 				return err;
Signature · 1 line
1.7.10.4