Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262755AbVEGWR4 (ORCPT ); Sat, 7 May 2005 18:17:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262757AbVEGWRz (ORCPT ); Sat, 7 May 2005 18:17:55 -0400 Received: from smtp105.mail.sc5.yahoo.com ([66.163.169.225]:123 "HELO smtp105.mail.sc5.yahoo.com") by vger.kernel.org with SMTP id S262755AbVEGWRo (ORCPT ); Sat, 7 May 2005 18:17:44 -0400 Message-ID: <427D3E7E.2020405@yahoo.com> Date: Sat, 07 May 2005 18:17:34 -0400 From: "J. Scott Kasten" User-Agent: Mozilla/5.0 (X11; U; IRIX64 IP30; en-US; rv:1.4.1) Gecko/20040105 X-Accept-Language: en-us, en MIME-Version: 1.0 To: rajat swarup CC: linux-kernel@vger.kernel.org Subject: Re: sending ICMP messages in kernel module References: <7d04ec5605050622006f3ad56c@mail.gmail.com> In-Reply-To: <7d04ec5605050622006f3ad56c@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1077 Lines: 29 rajat swarup wrote: >Hi, >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? > > Hello, 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. -Scott- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/