aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2007-12-11 05:25:01 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:12 -0500
commit87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98 (patch)
tree938179d4904406a82d35018c0d7b895505213124 /net
parent853cbbaaa4ccdf221be5ab6afe967aa9998546b7 (diff)
[IPV6]: make inet6_register_protosw to return an error code
This patch makes the inet6_register_protosw to return an error code. The different protocols can be aware the registration was successful or not and can pass the error to the initial caller, af_inet6. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/af_inet6.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a75c4bc9281a..53b06de696bd 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -565,21 +565,23 @@ static struct inet_protosw rawv6_protosw = {
565 .flags = INET_PROTOSW_REUSE, 565 .flags = INET_PROTOSW_REUSE,
566}; 566};
567 567
568void 568int inet6_register_protosw(struct inet_protosw *p)
569inet6_register_protosw(struct inet_protosw *p)
570{ 569{
571 struct list_head *lh; 570 struct list_head *lh;
572 struct inet_protosw *answer; 571 struct inet_protosw *answer;
573 int protocol = p->protocol;
574 struct list_head *last_perm; 572 struct list_head *last_perm;
573 int protocol = p->protocol;
574 int ret;
575 575
576 spin_lock_bh(&inetsw6_lock); 576 spin_lock_bh(&inetsw6_lock);
577 577
578 ret = -EINVAL;
578 if (p->type >= SOCK_MAX) 579 if (p->type >= SOCK_MAX)
579 goto out_illegal; 580 goto out_illegal;
580 581
581 /* If we are trying to override a permanent protocol, bail. */ 582 /* If we are trying to override a permanent protocol, bail. */
582 answer = NULL; 583 answer = NULL;
584 ret = -EPERM;
583 last_perm = &inetsw6[p->type]; 585 last_perm = &inetsw6[p->type];
584 list_for_each(lh, &inetsw6[p->type]) { 586 list_for_each(lh, &inetsw6[p->type]) {
585 answer = list_entry(lh, struct inet_protosw, list); 587 answer = list_entry(lh, struct inet_protosw, list);
@@ -603,9 +605,10 @@ inet6_register_protosw(struct inet_protosw *p)
603 * system automatically returns to the old behavior. 605 * system automatically returns to the old behavior.
604 */ 606 */
605 list_add_rcu(&p->list, last_perm); 607 list_add_rcu(&p->list, last_perm);
608 ret = 0;
606out: 609out:
607 spin_unlock_bh(&inetsw6_lock); 610 spin_unlock_bh(&inetsw6_lock);
608 return; 611 return ret;
609 612
610out_permanent: 613out_permanent:
611 printk(KERN_ERR "Attempt to override permanent protocol %d.\n", 614 printk(KERN_ERR "Attempt to override permanent protocol %d.\n",