lkml.org 
[lkml]   [2001]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectquery about sending udp packets in kernel mode
Hi All,

I need to send udp packets in a kernel module. but i am unable to figure
out how to specify fill the struct msghdr to be used by the sendmsg handler
of the socket.

my skeleton is something like (by going through the kernel code:>)

struct socket *sock;
struct sockaddr_in sin;
struct msghdr msg;

sock_creat(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
sin.sin_family = AF_INET;
sin.sin_port = htons((unsigned short)serv_port);
sin.sin_addr.s_addr = htonl(INADDR_ANY); /*i am not sure about this*/

msg.msg_name = &sin;
msg.msglen = sizeof(struct sockaddr_in);
msg.msg_iov = iovec_containg the message;
msg.msg_iovlen = 1;
msg.msg_control = NULL;
msg.msg_controllen=0;
msg.msg_flags =0;

sock->ops->sendmsg(sock,&msg,count,0);
________________________________________________


i am getting EFAULT.

or can anybody suggest me how to fill the address field of sin_addr in
kernel of any known remote address(corresponding inet_addr) so that
sendto/send can be used.
Any pointers will be greatly appreciated.

Thanks,
Anil.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:17    [W:0.060 / U:2.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site