mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
[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>
This commit is contained in:
parent
87c3efbfdd
commit
7f4e4868f3
8 changed files with 169 additions and 66 deletions
|
@ -1016,9 +1016,27 @@ static struct inet_protosw udpv6_protosw = {
|
|||
};
|
||||
|
||||
|
||||
void __init udpv6_init(void)
|
||||
int __init udpv6_init(void)
|
||||
{
|
||||
if (inet6_add_protocol(&udpv6_protocol, IPPROTO_UDP) < 0)
|
||||
printk(KERN_ERR "udpv6_init: Could not register protocol\n");
|
||||
inet6_register_protosw(&udpv6_protosw);
|
||||
int ret;
|
||||
|
||||
ret = inet6_add_protocol(&udpv6_protocol, IPPROTO_UDP);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = inet6_register_protosw(&udpv6_protosw);
|
||||
if (ret)
|
||||
goto out_udpv6_protocol;
|
||||
out:
|
||||
return ret;
|
||||
|
||||
out_udpv6_protocol:
|
||||
inet6_del_protocol(&udpv6_protocol, IPPROTO_UDP);
|
||||
goto out;
|
||||
}
|
||||
|
||||
void __exit udpv6_exit(void)
|
||||
{
|
||||
inet6_unregister_protosw(&udpv6_protosw);
|
||||
inet6_del_protocol(&udpv6_protocol, IPPROTO_UDP);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue