Commit 705e71ed authored by Eric Dumazet's avatar Eric Dumazet Committed by Greg Kroah-Hartman

inet: frags: refactor ipv6_frag_init()

commit 5b975bab23615cd0fdf67af6c9298eb01c4b9f61 upstream.

We want to call inet_frags_init() earlier.

This is a prereq to "inet: frags: use rhashtables for reassembly units"
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 4.4: Also delete a redundant assignment to
 ip6_frags.skb_free]
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c639cad
...@@ -739,10 +739,21 @@ int __init ipv6_frag_init(void) ...@@ -739,10 +739,21 @@ int __init ipv6_frag_init(void)
{ {
int ret; int ret;
ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT); ip6_frags.hashfn = ip6_hashfn;
ip6_frags.constructor = ip6_frag_init;
ip6_frags.destructor = NULL;
ip6_frags.qsize = sizeof(struct frag_queue);
ip6_frags.match = ip6_frag_match;
ip6_frags.frag_expire = ip6_frag_expire;
ip6_frags.frags_cache_name = ip6_frag_cache_name;
ret = inet_frags_init(&ip6_frags);
if (ret) if (ret)
goto out; goto out;
ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
if (ret)
goto err_protocol;
ret = ip6_frags_sysctl_register(); ret = ip6_frags_sysctl_register();
if (ret) if (ret)
goto err_sysctl; goto err_sysctl;
...@@ -751,17 +762,6 @@ int __init ipv6_frag_init(void) ...@@ -751,17 +762,6 @@ int __init ipv6_frag_init(void)
if (ret) if (ret)
goto err_pernet; goto err_pernet;
ip6_frags.hashfn = ip6_hashfn;
ip6_frags.constructor = ip6_frag_init;
ip6_frags.destructor = NULL;
ip6_frags.skb_free = NULL;
ip6_frags.qsize = sizeof(struct frag_queue);
ip6_frags.match = ip6_frag_match;
ip6_frags.frag_expire = ip6_frag_expire;
ip6_frags.frags_cache_name = ip6_frag_cache_name;
ret = inet_frags_init(&ip6_frags);
if (ret)
goto err_pernet;
out: out:
return ret; return ret;
...@@ -769,6 +769,8 @@ err_pernet: ...@@ -769,6 +769,8 @@ err_pernet:
ip6_frags_sysctl_unregister(); ip6_frags_sysctl_unregister();
err_sysctl: err_sysctl:
inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
err_protocol:
inet_frags_fini(&ip6_frags);
goto out; goto out;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment