From: aprasad@in.ibm.com
To: linux-kernel@vger.kernel.org
Subject: query about sending udp packets in kernel mode
Date: Fri, 16 Feb 2001 17:56:55 +0530 [thread overview]
Message-ID: <CA2569F5.0045056E.00@d73mta05.au.ibm.com> (raw)
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.
next reply other threads:[~2001-02-16 12:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-16 12:26 aprasad [this message]
2001-02-16 15:44 ` Andi Kleen
2001-02-17 10:44 ` Olaf Titz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA2569F5.0045056E.00@d73mta05.au.ibm.com \
--to=aprasad@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®