Commit f1caad27 authored by Gao feng's avatar Gao feng Committed by Pablo Neira Ayuso
Browse files

netfilter: nf_conntrack: prepare l4proto->init_net cleanup



l4proto->init contain quite redundant code. We can simplify this
by adding a new parameter l3proto.

This patch prepares that code simplification.

Signed-off-by: default avatarGao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent fa0f61f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ struct nf_conntrack_l4proto {
#endif
	int	*net_id;
	/* Init l4proto pernet data */
	int (*init_net)(struct net *net);
	int (*init_net)(struct net *net, u_int16_t proto);

	/* Protocol name */
	const char *name;
+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ static struct ctl_table icmp_compat_sysctl_table[] = {
#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
#endif /* CONFIG_SYSCTL */

static int icmp_init_net(struct net *net)
static int icmp_init_net(struct net *net, u_int16_t proto)
{
	struct nf_icmp_net *in = icmp_pernet(net);
	struct nf_proto_net *pn = (struct nf_proto_net *)in;
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ static struct ctl_table icmpv6_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */

static int icmpv6_init_net(struct net *net)
static int icmpv6_init_net(struct net *net, u_int16_t proto)
{
	struct nf_icmp_net *in = icmpv6_pernet(net);
	struct nf_proto_net *pn = (struct nf_proto_net *)in;
+3 −2
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ int nf_conntrack_l4proto_register(struct net *net,
	int ret = 0;

	if (l4proto->init_net) {
		ret = l4proto->init_net(net);
		ret = l4proto->init_net(net, l4proto->l3proto);
		if (ret < 0)
			return ret;
	}
@@ -515,7 +515,8 @@ int nf_conntrack_proto_init(struct net *net)
{
	unsigned int i;
	int err;
	err = nf_conntrack_l4proto_generic.init_net(net);
	err = nf_conntrack_l4proto_generic.init_net(net,
					nf_conntrack_l4proto_generic.l3proto);
	if (err < 0)
		return err;
	err = nf_ct_l4proto_register_sysctl(net,
+1 −1
Original line number Diff line number Diff line
@@ -815,7 +815,7 @@ static struct ctl_table dccp_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */

static int dccp_init_net(struct net *net)
static int dccp_init_net(struct net *net, u_int16_t proto)
{
	struct dccp_net *dn = dccp_pernet(net);
	struct nf_proto_net *pn = (struct nf_proto_net *)dn;
Loading