public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nalin gupta" <nalin_gupta@lycos.com>
To: "Joshua Stewart" <joshua.stewart@comcast.net>
Cc: gary@cotecorner.com, linux-kernel@vger.kernel.org
Subject: Re: Creating and sending a packet from a kernel module
Date: Fri, 21 Mar 2003 01:07:13 -0500	[thread overview]
Message-ID: <LLPAANEDLJJHAEAA@mailcity.com> (raw)

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

             reply	other threads:[~2003-03-21  5:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21  6:07 Nalin gupta [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-21  1:46 Creating and sending a packet from a kernel module Joshua Stewart

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=LLPAANEDLJJHAEAA@mailcity.com \
    --to=nalin_gupta@lycos.com \
    --cc=gary@cotecorner.com \
    --cc=joshua.stewart@comcast.net \
    --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