SCTP Help required

From: Fahad Saleem
Date: Thu Jul 20 2006 - 08:36:54 EST


I want to make a simple SCTP client server module in kernel space. Currently i am working on the server side. i have created an sctp socket ,binded it but when i listen it the module doesnt stop for new connection to come and return value of listen is 0. code is given below.
---for running this i have to modprobe sctp
static int sctps_init_module(void)
{
int s, outstreams = 1, instreams = 1, sendstream = 0;
int err,size;
int bufsize = 10;
unsigned char buf[bufsize+1];
sa_family_t family;


family = AF_INET;

err = sock_create_kern(family, SOCK_SEQPACKET, IPPROTO_SCTP, &sctp_ctl_socket);
if (err < 0) {
printk(KERN_ERR "SCTP: Failed to create the SCTP control socket.\n");
return err;
}

memset(&addr, 0, sizeof(struct sockaddr));
err = sock_create_kern(family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock2);


addr.sin_family = AF_INET;
addr.sin_port = htons(11);
addr.sin_addr.s_addr = INADDR_ANY;

if ( ( (err = sctp_ctl_socket->ops->bind(sctp_ctl_socket, (struct sockaddr *)&addr, sizeof(struct sockaddr) ) ) < 0))
{
printk(KERN_INFO MODULE_NAME": Could not bind or connect to socket, error = %d\n", -err);
goto out;
}


printk("\nBind Success");

memset(&buf, 0, bufsize+1);
size = ksocket_receive(sctp_ctl_socket, &addr, buf, bufsize);
printk("\nwas listening");


out:

return 0;
}

AND for listening

oldfs = get_fs();
set_fs(KERNEL_DS);
size = sock->ops->listen(sock,10);
err = sock->ops->accept(sock,sock2,40);
printk("\nsize = %d ",size);
set_fs(oldfs);
------------------------
M.Fahad Saleem

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html