From: "Real Oneone" <realoneone@gmail.com>
To: "Srinivas G." <srinivasg@esntechnologies.co.in>,
linux-kernel@vger.kernel.org
Subject: Re: How to re-send out the packets captured by my hook function at NF_IP_PRE_ROUTING
Date: Thu, 27 Apr 2006 23:02:26 +0800 [thread overview]
Message-ID: <84d7d9cf0604270802n308c2c9cs67ca0a7e4fbb8458@mail.gmail.com> (raw)
In-Reply-To: <AF63F67E8D577C4390B25443CBE3B9F73C0A@esnmail.esntechnologies.co.in>
Thanks for your reply, Srinivas!
But maybe I failed to describe the problem that I am facing. It's ture
as you said that I have a module, which registers a function to a
netfilter hook. Whenever there is an incoming packet, the function
could catch it and make some changes to it : wrap it in a new iphdr,
change the src and dst ip, etc. This is what I've done.
Now a problem comes that, how do I send it out directly? -- By
'directly', I mean to do it just in the kernel space, not first
passing it to a userspace application(thru NF_QUEUE like you said, or
netlink socket, anyway) and then let the application send it out.
The difficulty is that, since I changed the src and dst ip, the mac
address information is totally unavailable. That may be able to
explain the reason why I used skb->dev->hard_start_xmit(...) and then
the kernel crashed.
Is there any way to achieve my goal? Or that is mission impossible?
Wish I've explained clearly enough.
Many thanks for your help indeed!
Best regards,
Gu, Xinxing
2006/4/27, Srinivas G. <srinivasg@esntechnologies.co.in>:
>
> > I've read what you mentioned and since I've done most of the work in
> > kernelspace, I wonder if there is any way to send out the modified
> > packet directly, when of course the mac address is not filled?
>
> I am trying to understand your current situation. So you have a kernel
> module that is subscribed to a certain netfilter hook and as a result
> starts
> receiving packets; and now you want to pass these packets from your
> kernel
> module to a userspace application? Is this correct?
>
> If this is your current situation, you should issue a NF_QUEUE verdict
> for
> arriving packets in your kernel module to queue the packets to
> userspace.
> Subsequently, you will need to create a user space application to
> receive the queued packets and run it. You can use libipq to write a
> userspace
> application that will accept queued packets. See the man page of libipq
> for
> more information on how to do this (the man page contains a fully
> working
> example).
>
> Regards,
> Srinivas G
>
>
next parent reply other threads:[~2006-04-27 15:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AF63F67E8D577C4390B25443CBE3B9F73C0A@esnmail.esntechnologies.co.in>
2006-04-27 15:02 ` Real Oneone [this message]
[not found] <65RDw-7AC-33@gated-at.bofh.it>
2006-04-26 15:30 ` David G.
2006-04-27 2:11 ` Real Oneone
2006-04-26 12:46 Real Oneone
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=84d7d9cf0604270802n308c2c9cs67ca0a7e4fbb8458@mail.gmail.com \
--to=realoneone@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivasg@esntechnologies.co.in \
/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
Powered by JetHome