netfilter: ip6tables: unregister the tables by name
[linux-block.git] / net / ipv6 / netfilter / ip6_tables.c
index 2e2119bfcf137348e1ee77dcd360267e2ef47d77..11c80da12ee38583d120a023e71716584b2ebcb5 100644 (file)
@@ -1443,6 +1443,8 @@ translate_compat_table(struct net *net,
        if (!newinfo)
                goto out_unlock;
 
+       memset(newinfo->entries, 0, size);
+
        newinfo->number = compatr->num_entries;
        for (i = 0; i < NF_INET_NUMHOOKS; i++) {
                newinfo->hook_entry[i] = compatr->hook_entry[i];
@@ -1767,23 +1769,21 @@ out_free:
        return ret;
 }
 
-void ip6t_unregister_table_pre_exit(struct net *net, struct xt_table *table,
+void ip6t_unregister_table_pre_exit(struct net *net, const char *name,
                                    const struct nf_hook_ops *ops)
 {
-       nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
-}
+       struct xt_table *table = xt_find_table(net, NFPROTO_IPV6, name);
 
-void ip6t_unregister_table_exit(struct net *net, struct xt_table *table)
-{
-       __ip6t_unregister_table(net, table);
+       if (table)
+               nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
 }
 
-void ip6t_unregister_table(struct net *net, struct xt_table *table,
-                          const struct nf_hook_ops *ops)
+void ip6t_unregister_table_exit(struct net *net, const char *name)
 {
-       if (ops)
-               ip6t_unregister_table_pre_exit(net, table, ops);
-       __ip6t_unregister_table(net, table);
+       struct xt_table *table = xt_find_table(net, NFPROTO_IPV6, name);
+
+       if (table)
+               __ip6t_unregister_table(net, table);
 }
 
 /* Returns 1 if the type and code is matched by the range, 0 otherwise */
@@ -1933,7 +1933,6 @@ static void __exit ip6_tables_fini(void)
 }
 
 EXPORT_SYMBOL(ip6t_register_table);
-EXPORT_SYMBOL(ip6t_unregister_table);
 EXPORT_SYMBOL(ip6t_unregister_table_pre_exit);
 EXPORT_SYMBOL(ip6t_unregister_table_exit);
 EXPORT_SYMBOL(ip6t_do_table);