Re: netif_rx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi;

This may require some hacking but in order to isolate
which layer is causing the error; you can use the
*_INC_STATS hook. basically these are macros that are
called when an error occurs in the transmit/receive
path(I guess to inform via SNMP). The inputpath uses
the INC_STATS_BH hook; so tcp uses the
TCP_INC_STATS_BH and IP uses the IP_INC_STATS_BH hook.
So put  a printk in this macro whenever this gets
called; you will know whether the packets is getrting
dropped at the IP or the TCP layer. Then using the
__FUNCTION__, __LINE__ and __FILE__; you can get the
exact place in the code that is dropping the packet.

Let me know if this works...

regards
Ed

--- aksingh@hss.hns.com wrote:
> 
> 
> 
> 
> Hi,
> 
>  I am trying to spoof a packet, I have written a
> kernel module, once it
> gets a modified TCP packet(source and dest
> interchanged, ack seq
> interchanged) it calls netif_rx (skb) to inject this
> into the routing path.
> but I am unable to make this packet reach the
> correct socket. Any clues on
> this, can I check some kernel stats to know where
> and why the packet is
> being dropped.
> The various reasons cld be :
> 
> 1. incorrect tcp or ip check sums, i calculate both
> myself
> 2. in the skb->dev field i set the value to the
> value of skb->dev field of
> any incoming valid packet :
>  when i get the first packet on netfilter pre
> routing hook -- i do a
> memcpy(&my_net_dev, skb->dev, sizeof(struct
> net_device));
>  then for the modified TCP packet i set
> skb->dev=&my_net_dev. So maybe it
> gets dropped cos of some problem here(or is there
> any obvious problem here
> ?)
> 
> so how do i isolate the problem ? any clues ??
> 
> thanks
> Amit
> 
> "DISCLAIMER: This message is proprietary to Hughes
> Software Systems Limited
> (HSS) and is intended solely for the use of the
> individual to whom it is
> addressed. It may contain  privileged or
> confidential information and
> should not be circulated or used for any purpose
> other than for what it is
> intended. If you have received this message in
> error, please notify the
> originator immediately. If you are not the intended
> recipient, you are
> notified that you are strictly prohibited from
> using, copying, altering, or
> disclosing the contents of this message. HSS accepts
> no responsibility for
> loss or damage arising from the use of the
> information transmitted by this
> email including damage from virus."
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux