public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Creating and sending a packet from a kernel module
@ 2003-03-21  1:46 Joshua Stewart
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Stewart @ 2003-03-21  1:46 UTC (permalink / raw)
  To: linux-net, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

I'd like to create and send a brand new TCP SYN packet from a module. 
Does anybody have an example of how to do this.

I've tried doing alloc_skb, filling in all the information I could
imagine needing in skb->data, but what is the minimal amount of stuff
needed by the other parts of the skb to get this packet moving?

Is there an easy way to create and own a TCP socket from a module that I
could send and receive on?

Thanks,
	Josh

-- 
Joshua Stewart <joshua.stewart@comcast.net>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Creating and sending a packet from a kernel module
@ 2003-03-21  6:07 Nalin gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Nalin gupta @ 2003-03-21  6:07 UTC (permalink / raw)
  To: Joshua Stewart; +Cc: gary, linux-kernel

Joshua Stewart,

I saw that you are trying something similar, to me. I also found
Mr. Gary too is trying something similar. Though I do not have
proper solution for your problem, but it may be worth if you go
through few of these recent postings:

http://www.uwsg.iu.edu/hypermail/linux/kernel/0303.2/0437.html
http://www.uwsg.iu.edu/hypermail/linux/kernel/0303.2/0971.html
http://www.uwsg.iu.edu/hypermail/linux/kernel/0303.2/0974.html
http://www.uwsg.iu.edu/hypermail/linux/kernel/0303.2/0984.html

http://www.uwsg.iu.edu/hypermail/linux/net/0303.2/0043.html
http://www.uwsg.iu.edu/hypermail/linux/net/0303.1/0061.html

The above posting will tell you few problem which one faces,
while invoking sock_sendmsg from kernel module, in particular
when it is either in interrupt context or BH (net_bh) context.

I still wonder why ?

Only possibility I see to send / recv TCP/IP packet from kernel
module is using kernel thread.

Important API / structures are:

a.  sock_create - to create socket (like socket syscall)
b.  struct socket * sock
c.  sock->ops->bind     to bind to local address
d.  sock->ops->listen   like listen syscall
e.  sock_sendmsg       (never succeed in interrupt or BH context,
                        always fail in alloc_skb, I wonder why ?)
f.  sock_recvmsg  - Ordinary kernel module logically can not use
                    it. As you need some running thread context to
                    wait/block to receive on socket.

I've tried answering as per my limited know-how. 
Some one may like to add.

you may like to refer some example like khttpd under
/usr/src/linux/net

regards,
- nalin

--

On Thu, 20 Mar 2003 20:46:00  
 Joshua Stewart wrote:
>I'd like to create and send a brand new TCP SYN packet from a module. 
>Does anybody have an example of how to do this.
>
>I've tried doing alloc_skb, filling in all the information I could
>imagine needing in skb->data, but what is the minimal amount of stuff
>needed by the other parts of the skb to get this packet moving?
>
>Is there an easy way to create and own a TCP socket from a module that I
>could send and receive on?
>
>Thanks,
>	Josh
>
>-- 
>Joshua Stewart <joshua.stewart@comcast.net>
>


_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-21  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-21  6:07 Creating and sending a packet from a kernel module Nalin gupta
  -- strict thread matches above, loose matches on Subject: below --
2003-03-21  1:46 Joshua Stewart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox