Skip to content

Commit

Permalink
inet: frags: refactor ipv6_frag_init()
Browse files Browse the repository at this point in the history
We want to call inet_frags_init() earlier.

This is a prereq to "inet: frags: use rhashtables for reassembly units"

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 1, 2018
1 parent 093ba72 commit 5b975ba
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions net/ipv6/reassembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,21 @@ int __init ipv6_frag_init(void)
{
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)
goto out;

ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
if (ret)
goto err_protocol;

ret = ip6_frags_sysctl_register();
if (ret)
goto err_sysctl;
Expand All @@ -754,23 +765,15 @@ int __init ipv6_frag_init(void)
if (ret)
goto err_pernet;

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)
goto err_pernet;
out:
return ret;

err_pernet:
ip6_frags_sysctl_unregister();
err_sysctl:
inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
err_protocol:
inet_frags_fini(&ip6_frags);
goto out;
}

Expand Down

0 comments on commit 5b975ba

Please sign in to comment.