aboutsummaryrefslogtreecommitdiffstats
path: root/net/appletalk/ddp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/appletalk/ddp.c')
-rw-r--r--net/appletalk/ddp.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 8c55dbce87582..d1fea5c3dda1b 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1015,6 +1015,12 @@ static unsigned short atalk_checksum(const struct sk_buff *skb, int len)
return sum ? htons((unsigned short)sum) : 0xFFFF;
}
+static struct proto ddp_proto = {
+ .name = "DDP",
+ .owner = THIS_MODULE,
+ .obj_size = sizeof(struct atalk_sock),
+};
+
/*
* Create a socket. Initialise the socket, blank the addresses
* set the state.
@@ -1031,14 +1037,12 @@ static int atalk_create(struct socket *sock, int protocol)
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
goto out;
rc = -ENOMEM;
- sk = sk_alloc(PF_APPLETALK, GFP_KERNEL,
- sizeof(struct atalk_sock), NULL);
+ sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, &ddp_proto, 1);
if (!sk)
goto out;
rc = 0;
sock->ops = &atalk_dgram_ops;
sock_init_data(sock, sk);
- sk_set_owner(sk, THIS_MODULE);
/* Checksums on by default */
sock_set_flag(sk, SOCK_ZAPPED);
@@ -1874,6 +1878,11 @@ static char atalk_err_snap[] __initdata =
/* Called by proto.c on kernel start up */
static int __init atalk_init(void)
{
+ int rc = proto_register(&ddp_proto, 0);
+
+ if (rc != 0)
+ goto out;
+
(void)sock_register(&atalk_family_ops);
ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv);
if (!ddp_dl)
@@ -1886,7 +1895,8 @@ static int __init atalk_init(void)
aarp_proto_init();
atalk_proc_init();
atalk_register_sysctl();
- return 0;
+out:
+ return rc;
}
module_init(atalk_init);
@@ -1911,6 +1921,7 @@ static void __exit atalk_exit(void)
dev_remove_pack(&ppptalk_packet_type);
unregister_snap_client(ddp_dl);
sock_unregister(PF_APPLETALK);
+ proto_unregister(&ddp_proto);
}
module_exit(atalk_exit);