]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IPV6]: make frag to return an error at initialization
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 11 Dec 2007 10:24:29 +0000 (02:24 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:57:11 +0000 (14:57 -0800)
This patch makes the frag_init to return an error code, so the af_inet6
module can handle the error.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/transp_v6.h
net/ipv6/af_inet6.c
net/ipv6/reassembly.c

index 610b1bb775c962011fca18dca3466d7c90a13c8d..aa9a4a6b99df03cdb87fb81b00e81ec0ca32a805 100644 (file)
@@ -19,7 +19,8 @@ struct flowi;
 /* extention headers */
 extern int                             ipv6_exthdrs_init(void);
 extern void                            ipv6_exthdrs_exit(void);
-extern void                            ipv6_frag_init(void);
+extern int                             ipv6_frag_init(void);
+extern void                            ipv6_frag_exit(void);
 
 /* transport protocols */
 extern void                            rawv6_init(void);
index 442c298c1d7ca43c019a3a45f23a37ebd23a05e5..a75c4bc9281ae5eab1f9cbe3d8385ddd36931e27 100644 (file)
@@ -863,7 +863,9 @@ static int __init inet6_init(void)
        if (err)
                goto ipv6_exthdrs_fail;
 
-       ipv6_frag_init();
+       err = ipv6_frag_init();
+       if (err)
+               goto ipv6_frag_fail;
 
        /* Init v6 transport protocols. */
        udpv6_init();
@@ -875,6 +877,8 @@ static int __init inet6_init(void)
 out:
        return err;
 
+ipv6_frag_fail:
+       ipv6_exthdrs_exit();
 ipv6_exthdrs_fail:
        addrconf_cleanup();
 addrconf_fail:
@@ -934,7 +938,7 @@ static void __exit inet6_exit(void)
 
        /* Cleanup code parts. */
        ipv6_packet_cleanup();
-
+       ipv6_frag_exit();
        ipv6_exthdrs_exit();
        addrconf_cleanup();
        ip6_flowlabel_cleanup();
index 76c88a93b9b5a7714678a0ccb28aa140aa4e4998..bf4173daecbb21aea838be355fa53a069ecec0c0 100644 (file)
@@ -632,11 +632,13 @@ static struct inet6_protocol frag_protocol =
        .flags          =       INET6_PROTO_NOPOLICY,
 };
 
-void __init ipv6_frag_init(void)
+int __init ipv6_frag_init(void)
 {
-       if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0)
-               printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n");
+       int ret;
 
+       ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
+       if (ret)
+               goto out;
        ip6_frags.ctl = &ip6_frags_ctl;
        ip6_frags.hashfn = ip6_hashfn;
        ip6_frags.constructor = ip6_frag_init;
@@ -646,4 +648,12 @@ void __init ipv6_frag_init(void)
        ip6_frags.match = ip6_frag_match;
        ip6_frags.frag_expire = ip6_frag_expire;
        inet_frags_init(&ip6_frags);
+out:
+       return ret;
+}
+
+void ipv6_frag_exit(void)
+{
+       inet_frags_fini(&ip6_frags);
+       inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
 }