replace spaces with tab, beautify the code

This commit is contained in:
Chuck
2020-04-02 19:29:39 +08:00
committed by GitHub
parent f77130a32c
commit 177d28497f

View File

@@ -8,7 +8,7 @@ index 240a9bf57..9f8f37ca7 100644
CONFIG_BLK_DEV_IO_TRACE=y
+CONFIG_NETFILTER_XT_TARGET_FULLCONENAT=y
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index f17b40211..5af7577fd 100644
index f17b40211..99f691a67 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -239,6 +239,15 @@ config IP_NF_TARGET_NETMAP
@@ -16,22 +16,22 @@ index f17b40211..5af7577fd 100644
CONFIG_NETFILTER_XT_TARGET_NETMAP.
+config IP_NF_TARGET_FULLCONENAT
+ tristate "FULLCONENAT target support"
+ depends on NETFILTER_ADVANCED
+ select NETFILTER_XT_TARGET_FULLCONENAT
+ ---help---
+ This is a backwards-compat option for the user's convenience
+ (e.g. when running oldconfig). It selects
+ CONFIG_NETFILTER_XT_TARGET_FULLCONENAT.
+ tristate "FULLCONENAT target support"
+ depends on NETFILTER_ADVANCED
+ select NETFILTER_XT_TARGET_FULLCONENAT
+ ---help---
+ This is a backwards-compat option for the user's convenience
+ (e.g. when running oldconfig). It selects
+ CONFIG_NETFILTER_XT_TARGET_FULLCONENAT.
+
config IP_NF_TARGET_REDIRECT
tristate "REDIRECT target support"
depends on NETFILTER_ADVANCED
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 91efae88e..6fd1c3cfd 100644
index 91efae88e..17f5c748a 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -956,6 +956,15 @@ config NETFILTER_XT_TARGET_NETMAP
@@ -956,6 +956,14 @@ config NETFILTER_XT_TARGET_NETMAP
To compile it as a module, choose M here. If unsure, say N.
@@ -42,25 +42,24 @@ index 91efae88e..6fd1c3cfd 100644
+ Full Cone NAT
+
+ To compile it as a module, choose M here. If unsure, say N.
+
+
config NETFILTER_XT_TARGET_NFLOG
tristate '"NFLOG" target support'
default m if NETFILTER_ADVANCED=n
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index 4fc075b61..eea8bfd0b 100644
index 4fc075b61..2b588d5a5 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -209,3 +209,6 @@ obj-$(CONFIG_IP_SET) += ipset/
# IPVS
obj-$(CONFIG_IP_VS) += ipvs/
+
+# Full cone NAT
+obj-$(CONFIG_NETFILTER_XT_TARGET_FULLCONENAT) += xt_FULLCONENAT.o
+
diff --git a/net/netfilter/xt_FULLCONENAT.c b/net/netfilter/xt_FULLCONENAT.c
new file mode 100644
index 000000000000..8555b54e2dc6
index 000000000..8555b54e2
--- /dev/null
+++ b/net/netfilter/xt_FULLCONENAT.c
@@ -0,0 +1,733 @@
@@ -203,7 +202,7 @@ index 000000000000..8555b54e2dc6
+ hash_add(mapping_table_by_ext_port, &p_new->node_by_ext_port, port);
+ hash_add(mapping_table_by_int_src, &p_new->node_by_int_src, hash_src);
+
+ pr_debug("xt_FULLCONENAT: new mapping allocated for %pI4:%d ==> %d\n",
+ pr_debug("xt_FULLCONENAT: new mapping allocated for %pI4:%d ==> %d\n",
+ &p_new->int_addr, p_new->int_port, p_new->port);
+
+ return p_new;
@@ -344,7 +343,7 @@ index 000000000000..8555b54e2dc6
+ item = list_entry(iter, struct tuple_list, list);
+
+ /* we dont know the conntrack direction for now so we try in both ways. */
+ ct_tuple = &(item->tuple_original);
+ ct_tuple = &(item->tuple_original);
+ ip = (ct_tuple->src).u3.ip;
+ port = be16_to_cpu((ct_tuple->src).u.udp.port);
+ mapping = get_mapping_by_int_src(ip, port);