On Thu, Feb 22, 2007 at 12:52:40PM +0200, Mark Ryden wrote: > Hello, > > Is it possible somehow to create a TCP socket from kernel and to send > a message when you are in interrupt context ? No, that will block and you can't block in an interrupt. > I made a test : I created a kernel socket with > sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock) > and then connected it with: > sock->ops->connect(sock, > (struct sockaddr*)&addr, > sizeof(struct sockaddr), 0) > > When working NOT in interrupt context,it works OK; I called : > kernel_sendmsg(sock, &msg, &iov, 1, length); > and a TCP packet WAS sent (I verified it with a sniffer) > > BUT, in interrupt context, I called : > kernel_sendmsg(sock, &msg, &iov, 1, length); > > I got: > Feb 22 12:02:54 markhost kernel: BUG: sleeping function called from > invalid context > Feb 22 12:02:54 markhost: in_atomic():1, irqs_disabled():0 > > Why is it so ? is there another way create a kernel TCP socket > and to send a packet? Why on earth are you trying to start a TCP connection from the kernel in the first place? This smells like a very bad design, you really ought to do this from userspace. Erik -- They're all fools. Don't worry. Darwin may be slow, but he'll eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
Attachment:
signature.asc
Description: Digital signature