Commit b59eaf9e authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: combine IPv4 and IPv6 nf_nat_redirect code in one module



This resolves linking problems with CONFIG_IPV6=n:

net/built-in.o: In function `redirect_tg6':
xt_REDIRECT.c:(.text+0x6d021): undefined reference to `nf_nat_redirect_ipv6'

Reported-by: default avatarAndreas Ruprecht <rupran@einserver.de>
Reported-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 1b63d4b9
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
#ifndef _NF_NAT_REDIRECT_IPV6_H_
#define _NF_NAT_REDIRECT_IPV6_H_

unsigned int
nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range *range,
		     unsigned int hooknum);

#endif /* _NF_NAT_REDIRECT_IPV6_H_ */
+12 −0
Original line number Original line Diff line number Diff line
#ifndef _NF_NAT_REDIRECT_IPV4_H_
#ifndef _NF_NAT_REDIRECT_H_
#define _NF_NAT_REDIRECT_IPV4_H_
#define _NF_NAT_REDIRECT_H_


unsigned int
unsigned int
nf_nat_redirect_ipv4(struct sk_buff *skb,
nf_nat_redirect_ipv4(struct sk_buff *skb,
		     const struct nf_nat_ipv4_multi_range_compat *mr,
		     const struct nf_nat_ipv4_multi_range_compat *mr,
		     unsigned int hooknum);
		     unsigned int hooknum);
unsigned int
nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range *range,
		     unsigned int hooknum);


#endif /* _NF_NAT_REDIRECT_IPV4_H_ */
#endif /* _NF_NAT_REDIRECT_H_ */
+1 −7
Original line number Original line Diff line number Diff line
@@ -104,12 +104,6 @@ config NF_NAT_MASQUERADE_IPV4
	  This is the kernel functionality to provide NAT in the masquerade
	  This is the kernel functionality to provide NAT in the masquerade
	  flavour (automatic source address selection).
	  flavour (automatic source address selection).


config NF_NAT_REDIRECT_IPV4
	tristate "IPv4 redirect support"
	help
	  This is the kernel functionality to provide NAT in the redirect
	  flavour (redirect packets to local machine).

config NFT_MASQ_IPV4
config NFT_MASQ_IPV4
	tristate "IPv4 masquerading support for nf_tables"
	tristate "IPv4 masquerading support for nf_tables"
	depends on NF_TABLES_IPV4
	depends on NF_TABLES_IPV4
@@ -123,7 +117,7 @@ config NFT_REDIR_IPV4
	tristate "IPv4 redirect support for nf_tables"
	tristate "IPv4 redirect support for nf_tables"
	depends on NF_TABLES_IPV4
	depends on NF_TABLES_IPV4
	depends on NFT_REDIR
	depends on NFT_REDIR
	select NF_NAT_REDIRECT_IPV4
	select NF_NAT_REDIRECT
	help
	help
	  This is the expression that provides IPv4 redirect support for
	  This is the expression that provides IPv4 redirect support for
	  nf_tables.
	  nf_tables.
+0 −1
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o
obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o
obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o
obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o
obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o
obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
obj-$(CONFIG_NF_NAT_REDIRECT_IPV4) += nf_nat_redirect_ipv4.o


# NAT protocols (nf_nat)
# NAT protocols (nf_nat)
obj-$(CONFIG_NF_NAT_PROTO_GRE) += nf_nat_proto_gre.o
obj-$(CONFIG_NF_NAT_PROTO_GRE) += nf_nat_proto_gre.o
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
#include <linux/netfilter/nf_tables.h>
#include <linux/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_nat.h>
#include <net/netfilter/nf_nat.h>
#include <net/netfilter/ipv4/nf_nat_redirect.h>
#include <net/netfilter/nf_nat_redirect.h>
#include <net/netfilter/nft_redir.h>
#include <net/netfilter/nft_redir.h>


static void nft_redir_ipv4_eval(const struct nft_expr *expr,
static void nft_redir_ipv4_eval(const struct nft_expr *expr,
Loading