netfilter: remove ip_conntrack* sysctl compat code
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: remove ip_conntrack* sysctl compat code
This backward compatibility has been around for more than ten years, since Yasuyuki Kozakai introduced IPv6 in conntrack. These days, we have alternate /proc/net/nf_conntrack* entries, the ctnetlink interface and the conntrack utility got adopted by many people in the user community according to what I observed on the netfilter user mailing list.
So let's get rid of this.
Note that nf_conntrack_htable_size and unsigned int nf_conntrack_max do not need to be exported as symbol anymore.
--- include/net/netfilter/nf_conntrack_l4proto.h | 8 - include/net/netns/conntrack.h | 8 - net/ipv4/netfilter/Kconfig | 11 - net/ipv4/netfilter/Makefile | 5 - net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 70 --- .../netfilter/nf_conntrack_l3proto_ipv4_compat.c | 491 --------------------- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 39 +- net/netfilter/nf_conntrack_core.c | 3 - net/netfilter/nf_conntrack_proto.c | 81 +--- net/netfilter/nf_conntrack_proto_generic.c | 39 +- net/netfilter/nf_conntrack_proto_sctp.c | 85 +--- net/netfilter/nf_conntrack_proto_tcp.c | 127 +----- net/netfilter/nf_conntrack_proto_udp.c | 49 +- 13 files changed, 7 insertions(+), 1009 deletions(-) delete mode 100644 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
include/net/netfilter/nf_conntrack_l4proto.h +0 -8
@@ -134,14 +134,6 @@ void nf_ct_l4proto_pernet_unregister(struct net *net,int nf_ct_l4proto_register (struct nf_conntrack_l4proto *proto);void nf_ct_l4proto_unregister (struct nf_conntrack_l4proto *proto); -static inline void nf_ct_kfree_compat_sysctl_table (struct nf_proto_net *pn) -{ -#if defined(CONFIG_SYSCTL ) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT ) -kfree (pn->ctl_compat_table); - pn->ctl_compat_table =NULL ; -#endif -} -/* Generic netlink helpers */ int nf_ct_port_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple);
include/net/netns/conntrack.h +0 -8
@@ -15,10 +15,6 @@ struct nf_proto_net {#ifdef CONFIG_SYSCTL struct ctl_table_header *ctl_table_header;struct ctl_table *ctl_table; -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT -struct ctl_table_header *ctl_compat_header; -struct ctl_table *ctl_compat_table; -#endif #endif unsigned int users; };
@@ -58,10 +54,6 @@ struct nf_ip_net {struct nf_udp_net udp;struct nf_icmp_net icmp;struct nf_icmp_net icmpv6; -#if defined(CONFIG_SYSCTL ) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT ) -struct ctl_table_header *ctl_table_header; -struct ctl_table *ctl_table; -#endif };struct ct_pcpu {
net/ipv4/netfilter/Kconfig +0 -11
@@ -25,17 +25,6 @@ config NF_CONNTRACK_IPV4 To compile it as a module, choose M here. If unsure, say N. -config NF_CONNTRACK_PROC_COMPAT - bool "proc/sysctl compatibility with old connection tracking" - depends on NF_CONNTRACK_PROCFS && NF_CONNTRACK_IPV4 - default y - help - This option enables /proc and sysctl compatibility with the old - layer 3 dependent connection tracking. This is needed to keep - old programs that have not been adapted to the new names working. - - If unsure, say Y. - if NF_TABLES config NF_TABLES_IPV4
net/ipv4/netfilter/Makefile +0 -5
@@ -4,11 +4,6 @@ # objects for l3 independent conntrack nf_conntrack_ipv4-y := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o -ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y) -ifeq ($(CONFIG_PROC_FS),y) -nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o -endif -endif # connection tracking obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +0 -70
101 lines not on this page · raw message
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c deleted +0 -491
491 lines not on this page · raw message
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +1 -38
@@ -327,17 +327,6 @@ static struct ctl_table icmp_sysctl_table[] = { }, { } }; -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT -static struct ctl_table icmp_compat_sysctl_table[] = { - { - .procname ="ip_conntrack_icmp_timeout" , - .maxlen =sizeof (unsigned int ), - .mode =0644 , - .proc_handler = proc_dointvec_jiffies, - }, - { } -}; -#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */ #endif /* CONFIG_SYSCTL */ static int icmp_kmemdup_sysctl_table(struct nf_proto_net *pn,
@@ -355,40 +344,14 @@ static int icmp_kmemdup_sysctl_table(struct nf_proto_net *pn,return 0 ; } -static int icmp_kmemdup_compat_sysctl_table (struct nf_proto_net *pn, -struct nf_icmp_net *in) -{ -#ifdef CONFIG_SYSCTL -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT - pn->ctl_compat_table =kmemdup (icmp_compat_sysctl_table, -sizeof (icmp_compat_sysctl_table), -GFP_KERNEL ); -if (!pn->ctl_compat_table) -return -ENOMEM ; - - pn->ctl_compat_table[0 ].data = &in->timeout; -#endif -#endif -return 0 ; -} -static int icmp_init_net (struct net *net,u_int16_t proto) { -int ret;struct nf_icmp_net *in =icmp_pernet (net);struct nf_proto_net *pn = &in->pn; in->timeout = nf_ct_icmp_timeout; - ret =icmp_kmemdup_compat_sysctl_table (pn, in); -if (ret <0 ) -return ret; - - ret =icmp_kmemdup_sysctl_table (pn, in); -if (ret <0 ) -nf_ct_kfree_compat_sysctl_table (pn); - -return ret; +return icmp_kmemdup_sysctl_table (pn, in); }static struct nf_proto_net *icmp_get_net_proto (struct net *net)
net/netfilter/nf_conntrack_core.c +0 -3
@@ -161,10 +161,7 @@ static void nf_conntrack_all_unlock(void) }unsigned int nf_conntrack_htable_size__read_mostly ; -EXPORT_SYMBOL_GPL (nf_conntrack_htable_size); -unsigned int nf_conntrack_max__read_mostly ; -EXPORT_SYMBOL_GPL (nf_conntrack_max); DEFINE_PER_CPU(struct nf_conn, nf_conntrack_untracked);EXPORT_PER_CPU_SYMBOL (nf_conntrack_untracked);
net/netfilter/nf_conntrack_proto.c +2 -79
117 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_generic.c +1 -38
@@ -151,17 +151,6 @@ static struct ctl_table generic_sysctl_table[] = { }, { } }; -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT -static struct ctl_table generic_compat_sysctl_table[] = { - { - .procname ="ip_conntrack_generic_timeout" , - .maxlen =sizeof (unsigned int ), - .mode =0644 , - .proc_handler = proc_dointvec_jiffies, - }, - { } -}; -#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */ #endif /* CONFIG_SYSCTL */ static int generic_kmemdup_sysctl_table(struct nf_proto_net *pn,
@@ -179,40 +168,14 @@ static int generic_kmemdup_sysctl_table(struct nf_proto_net *pn,return 0 ; } -static int generic_kmemdup_compat_sysctl_table (struct nf_proto_net *pn, -struct nf_generic_net *gn) -{ -#ifdef CONFIG_SYSCTL -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT - pn->ctl_compat_table =kmemdup (generic_compat_sysctl_table, -sizeof (generic_compat_sysctl_table), -GFP_KERNEL ); -if (!pn->ctl_compat_table) -return -ENOMEM ; - - pn->ctl_compat_table[0 ].data = &gn->timeout; -#endif -#endif -return 0 ; -} -static int generic_init_net (struct net *net,u_int16_t proto) { -int ret;struct nf_generic_net *gn =generic_pernet (net);struct nf_proto_net *pn = &gn->pn; gn->timeout = nf_ct_generic_timeout; - ret =generic_kmemdup_compat_sysctl_table (pn, gn); -if (ret <0 ) -return ret; - - ret =generic_kmemdup_sysctl_table (pn, gn); -if (ret <0 ) -nf_ct_kfree_compat_sysctl_table (pn); - -return ret; +return generic_kmemdup_sysctl_table (pn, gn); }static struct nf_proto_net *generic_get_net_proto (struct net *net)
net/netfilter/nf_conntrack_proto_sctp.c +1 -84
105 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_tcp.c +1 -126
147 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_udp.c +1 -48
69 lines not on this page · raw message
Signature · 1 line
2.1.4
Hi Pablo,
2016-08-12 19:47 GMT+08:00 Pablo Neira Ayuso <[email protected]>:
net/netfilter/nf_conntrack_core.c static void nf_conntrack_all_unlock(void) · line 164
Quoted 9 lines
net/netfilter/nf_conntrack_core.c +0
-1@@ -161,10 +161,7 @@ static void nf_conntrack_all_unlock(void) }unsigned int nf_conntrack_htable_size__read_mostly ; -EXPORT_SYMBOL_GPL (nf_conntrack_htable_size);
We still need to export nf_conntrack_htable_size, otherwise:
ERROR: "nf_conntrack_htable_size" [net/netfilter/nfnetlink_cttimeout.ko] undefined!
ERROR: "nf_conntrack_htable_size" [net/netfilter/nf_conntrack_netlink.ko] undefined!
ERROR: "nf_conntrack_htable_size" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!
Pablo Neira Ayuso
maintainerQuoted 14 lines · Liping Zhang
Hi Pablo,
2016-08-12 19:47 GMT+08:00 Pablo Neira Ayuso <[email protected]>:net/netfilter/nf_conntrack_core.c static void nf_conntrack_all_unlock(void) · line 164
Quoted 9 lines
net/netfilter/nf_conntrack_core.c +0
-1@@ -161,10 +161,7 @@ static void nf_conntrack_all_unlock(void) }unsigned int nf_conntrack_htable_size__read_mostly ; -EXPORT_SYMBOL_GPL (nf_conntrack_htable_size);We still need to export
nf_conntrack_htable_size, otherwise:
Quoted 6 lines
ERROR: "
nf_conntrack_htable_size" [net/netfilter/nfnetlink_cttimeout.ko] undefined!
ERROR: "nf_conntrack_htable_size" [net/netfilter/nf_conntrack_netlink.ko] undefined!
ERROR: "nf_conntrack_htable_size" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!
I see, will send a v2. Thanks!