aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/transp_v6.h3
-rw-r--r--net/ipv6/af_inet6.c8
-rw-r--r--net/ipv6/reassembly.c16
3 files changed, 21 insertions, 6 deletions
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 610b1bb775c9..aa9a4a6b99df 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -19,7 +19,8 @@ struct flowi;
19/* extention headers */ 19/* extention headers */
20extern int ipv6_exthdrs_init(void); 20extern int ipv6_exthdrs_init(void);
21extern void ipv6_exthdrs_exit(void); 21extern void ipv6_exthdrs_exit(void);
22extern void ipv6_frag_init(void); 22extern int ipv6_frag_init(void);
23extern void ipv6_frag_exit(void);
23 24
24/* transport protocols */ 25/* transport protocols */
25extern void rawv6_init(void); 26extern void rawv6_init(void);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 442c298c1d7c..a75c4bc9281a 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -863,7 +863,9 @@ static int __init inet6_init(void)
863 if (err) 863 if (err)
864 goto ipv6_exthdrs_fail; 864 goto ipv6_exthdrs_fail;
865 865
866 ipv6_frag_init(); 866 err = ipv6_frag_init();
867 if (err)
868 goto ipv6_frag_fail;
867 869
868 /* Init v6 transport protocols. */ 870 /* Init v6 transport protocols. */
869 udpv6_init(); 871 udpv6_init();
@@ -875,6 +877,8 @@ static int __init inet6_init(void)
875out: 877out:
876 return err; 878 return err;
877 879
880ipv6_frag_fail:
881 ipv6_exthdrs_exit();
878ipv6_exthdrs_fail: 882ipv6_exthdrs_fail:
879 addrconf_cleanup(); 883 addrconf_cleanup();
880addrconf_fail: 884addrconf_fail:
@@ -934,7 +938,7 @@ static void __exit inet6_exit(void)
934 938
935 /* Cleanup code parts. */ 939 /* Cleanup code parts. */
936 ipv6_packet_cleanup(); 940 ipv6_packet_cleanup();
937 941 ipv6_frag_exit();
938 ipv6_exthdrs_exit(); 942 ipv6_exthdrs_exit();
939 addrconf_cleanup(); 943 addrconf_cleanup();
940 ip6_flowlabel_cleanup(); 944 ip6_flowlabel_cleanup();
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 76c88a93b9b5..bf4173daecbb 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -632,11 +632,13 @@ static struct inet6_protocol frag_protocol =
632 .flags = INET6_PROTO_NOPOLICY, 632 .flags = INET6_PROTO_NOPOLICY,
633}; 633};
634 634
635void __init ipv6_frag_init(void) 635int __init ipv6_frag_init(void)
636{ 636{
637 if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0) 637 int ret;
638 printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n");
639 638
639 ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
640 if (ret)
641 goto out;
640 ip6_frags.ctl = &ip6_frags_ctl; 642 ip6_frags.ctl = &ip6_frags_ctl;
641 ip6_frags.hashfn = ip6_hashfn; 643 ip6_frags.hashfn = ip6_hashfn;
642 ip6_frags.constructor = ip6_frag_init; 644 ip6_frags.constructor = ip6_frag_init;
@@ -646,4 +648,12 @@ void __init ipv6_frag_init(void)
646 ip6_frags.match = ip6_frag_match; 648 ip6_frags.match = ip6_frag_match;
647 ip6_frags.frag_expire = ip6_frag_expire; 649 ip6_frags.frag_expire = ip6_frag_expire;
648 inet_frags_init(&ip6_frags); 650 inet_frags_init(&ip6_frags);
651out:
652 return ret;
653}
654
655void ipv6_frag_exit(void)
656{
657 inet_frags_fini(&ip6_frags);
658 inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
649} 659}