From: rajat swarup <rajats@gmail.com>
To: "J. Scott Kasten" <jscottkasten@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sending ICMP messages in kernel module
Date: Sat, 7 May 2005 16:39:49 -0700 [thread overview]
Message-ID: <7d04ec5605050716393c5a71ca@mail.gmail.com> (raw)
In-Reply-To: <427D3E7E.2020405@yahoo.com>
On 5/7/05, J. Scott Kasten <jscottkasten@yahoo.com> wrote:
>
> rajat swarup wrote:
>
> >I have placed a netfilter hook in which I grab the packets in the
> >pre-routing stage.
> >I need to send ICMP messages in response to certain messages in this hook.
> >I looked at alloc_skb(), skb_reserve() and skb_put() functions but it
> >is still not clear to me as to how to construct the packets using
> >these methods.
> >Since I am getting the packets in the Pre-routing stage should I
> >explicitly construct the MAC header, IP header & data & ICMP message?
> >Also, I'll need to calculate the checksum to be transmitted in the
> >ICMP packet...which method could I use to do that?
> >
> >
>
> I had a similar problem once. In the icmp.c file, look at how the ping
> echo reply works. That is as close to a tutorial as you will find in
> the code. I think you might find it strait forward from there.
>
Hi Scott,
I am trying to send ICMP messages but not in reply to anything else.
We have to generate ICMP messages from scratch.
So we do not have access to an existing sk_buff structure that has all
the parameters already set.
icmp_echo(struct skbuff*) assumes that you already have the sk_buff
structure and you are just assigning a few more fields.
Do you have an idea about how can we create ICMP messages from scratch?
Thanks for the help!
-Rajat.
http://rajatswarup.blogspot.com/
prev parent reply other threads:[~2005-05-07 23:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-07 5:00 rajat swarup
2005-05-07 22:17 ` J. Scott Kasten
2005-05-07 23:39 ` rajat swarup [this message]
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=7d04ec5605050716393c5a71ca@mail.gmail.com \
--to=rajats@gmail.com \
--cc=jscottkasten@yahoo.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
Powered by JetHome