#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num);
extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num);
-extern void inet6_register_protosw(struct inet_protosw *p);
+extern int inet6_register_protosw(struct inet_protosw *p);
extern void inet6_unregister_protosw(struct inet_protosw *p);
#endif
.flags = INET_PROTOSW_REUSE,
};
-void
-inet6_register_protosw(struct inet_protosw *p)
+int inet6_register_protosw(struct inet_protosw *p)
{
struct list_head *lh;
struct inet_protosw *answer;
- int protocol = p->protocol;
struct list_head *last_perm;
+ int protocol = p->protocol;
+ int ret;
spin_lock_bh(&inetsw6_lock);
+ ret = -EINVAL;
if (p->type >= SOCK_MAX)
goto out_illegal;
/* If we are trying to override a permanent protocol, bail. */
answer = NULL;
+ ret = -EPERM;
last_perm = &inetsw6[p->type];
list_for_each(lh, &inetsw6[p->type]) {
answer = list_entry(lh, struct inet_protosw, list);
* system automatically returns to the old behavior.
*/
list_add_rcu(&p->list, last_perm);
+ ret = 0;
out:
spin_unlock_bh(&inetsw6_lock);
- return;
+ return ret;
out_permanent:
printk(KERN_ERR "Attempt to override permanent protocol %d.\n",