LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-15-2005, 02:22 PM   #1
porous
Member
 
Registered: Oct 2003
Distribution: redhat 9
Posts: 147

Rep: Reputation: 15
stack droping packets (netif_rx)


hi everyone,

i am trying to understand the interface between a device driver and the tcp/ip protocol stack on a linux 2.4.20 kernel. I met with some unknown's. here is wat i have tried.

i hooked up my driver (a very minimal pseudo driver) , which has a
{ hard_start_xmit:my_tx() }.
the stack when it wants to send a packet is sucessfully calling my
my_tx(sk_buff skb);

wht i did then was to do a

nskb=dev_alloc_skb(skb->len);
skb_put(nskb,skb->len);
memcpy(nskb->dat,skb->data,skb->len);

oh!!! i forgot to tell you , that i was checking my application with the ping utility..

then i interchanged the source and destination ip's in the payload,(ie nskb->data ). recalculated the checksum for ip. then changed the
icmp->type =oxo;(echo reply). and again recalculated the icmp checksum.

after this i tried to call
netif_rx(skb);

this call suceeds but, unfortunatley my packet is not deliverd to the ping application. i dont knwo why the stack is droping the packet on the way up.
if someones knows more about this i shall be very thankful if you could just share the information.

i also tried to sniff the packets with ethereal, its able to capture both the packets, there is no checksum error in my modified packet which i wanted to ping program to accept as a reply to its icmp echo reply..

i am stuck at this point.. if you need further info i shall be glad to post it.
hoping for a reply from friends in LQ..
 
Old 04-16-2005, 06:35 AM   #2
porous
Member
 
Registered: Oct 2003
Distribution: redhat 9
Posts: 147

Original Poster
Rep: Reputation: 15
i forgot to add ..
before calling

netif_rx(skb);

i did do the usual ,

skb->protocol = eth_type_trans(skb,dev);
skb->dev = dev;

i can post the code if needed..
 
Old 04-21-2005, 09:16 AM   #3
porous
Member
 
Registered: Oct 2003
Distribution: redhat 9
Posts: 147

Original Poster
Rep: Reputation: 15
i write this post so if anyone else runs into a similar probs. my porblem was with the eth_trans_type(). the value returned was error. i was using a customised function. do remember to use the kernel exported function if possible.

rgrds
allen
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference b/t Kernel stack and User stack hazzyb Linux - Software 2 09-29-2008 07:40 PM
IP Table help, Droping entire 200 block of ip's? Wide glide Linux - Security 2 12-03-2004 12:39 AM
packets sent VS packets received fsasya Linux - Networking 0 07-18-2004 07:11 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
URGENT - Cant boot up. ...droping you to a shell.... ForumKid Linux - General 2 02-02-2002 01:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration