On Fri, Oct 21, 2016 at 04:42:40PM +0200, Davide Caratti wrote: > modify registration and deregistration of layer-4 protocol trackers to > facilitate inclusion of new elements into the current list of built-in > protocols. > > Signed-off-by: Davide Caratti <dcaratti@xxxxxxxxxx> > --- > net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 93 +++++++++++--------------- > net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 93 +++++++++++--------------- > 2 files changed, 78 insertions(+), 108 deletions(-) > > diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c > index 713c09a..6ffe3dc 100644 > --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c > +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c > @@ -336,47 +336,44 @@ MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); > MODULE_ALIAS("ip_conntrack"); > MODULE_LICENSE("GPL"); > > +static struct nf_conntrack_l4proto *nf_conntrack_l4proto4[] = { > + &nf_conntrack_l4proto_tcp4, > + &nf_conntrack_l4proto_udp4, > + &nf_conntrack_l4proto_icmp, > +}; > + > static int ipv4_net_init(struct net *net) > { > - int ret = 0; > + int i, ret = 0; > > - ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_tcp4); > - if (ret < 0) { > - pr_err("nf_conntrack_tcp4: pernet registration failed\n"); > - goto out_tcp; > - } > - ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_udp4); > - if (ret < 0) { > - pr_err("nf_conntrack_udp4: pernet registration failed\n"); > - goto out_udp; > - } > - ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_icmp); > - if (ret < 0) { > - pr_err("nf_conntrack_icmp4: pernet registration failed\n"); > - goto out_icmp; > + for (i = 0; i < ARRAY_SIZE(nf_conntrack_l4proto4); i++) { > + ret = nf_ct_l4proto_pernet_register(net, > + nf_conntrack_l4proto4[i]); > + if (ret < 0) > + goto cleanup_l4proto; Could you add: ret = nf_ct_l4proto_pernet_register(net, nf_conntrack_l4proto4, ARRAY_SIZE(nf_conntrack_l4proto4)); ? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html