diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2007-12-11 05:25:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:13 -0500 |
commit | 7f4e4868f3ce0e946f116c28fa4fe033be5e4ba9 (patch) | |
tree | 144add1d4c94a145f7e048a17d91b563f5e6e265 /net/ipv6/udplite.c | |
parent | 87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98 (diff) |
[IPV6]: make the protocol initialization to return an error code
This patchset makes the different protocols to return an error code, so
the af_inet6 module can check the initialization was correct or not.
The raw6 was taken into account to be consistent with the rest of the
protocols, but the registration is at the same place.
Because the raw6 has its own init function, the proto and the ops structure
can be moved inside the raw6.c file.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udplite.c')
-rw-r--r-- | net/ipv6/udplite.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c index 5a0379f71415..f20b376689fb 100644 --- a/net/ipv6/udplite.c +++ b/net/ipv6/udplite.c | |||
@@ -77,12 +77,29 @@ static struct inet_protosw udplite6_protosw = { | |||
77 | .flags = INET_PROTOSW_PERMANENT, | 77 | .flags = INET_PROTOSW_PERMANENT, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | void __init udplitev6_init(void) | 80 | int __init udplitev6_init(void) |
81 | { | 81 | { |
82 | if (inet6_add_protocol(&udplitev6_protocol, IPPROTO_UDPLITE) < 0) | 82 | int ret; |
83 | printk(KERN_ERR "%s: Could not register.\n", __FUNCTION__); | ||
84 | 83 | ||
85 | inet6_register_protosw(&udplite6_protosw); | 84 | ret = inet6_add_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); |
85 | if (ret) | ||
86 | goto out; | ||
87 | |||
88 | ret = inet6_register_protosw(&udplite6_protosw); | ||
89 | if (ret) | ||
90 | goto out_udplitev6_protocol; | ||
91 | out: | ||
92 | return ret; | ||
93 | |||
94 | out_udplitev6_protocol: | ||
95 | inet6_del_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); | ||
96 | goto out; | ||
97 | } | ||
98 | |||
99 | void __exit udplitev6_exit(void) | ||
100 | { | ||
101 | inet6_unregister_protosw(&udplite6_protosw); | ||
102 | inet6_del_protocol(&udplitev6_protocol, IPPROTO_UDPLITE); | ||
86 | } | 103 | } |
87 | 104 | ||
88 | #ifdef CONFIG_PROC_FS | 105 | #ifdef CONFIG_PROC_FS |