LinuxQuestions.org
Visit Jeremy's Blog.
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-23-2005, 03:45 AM   #1
linux_lover2005
Member
 
Registered: Dec 2004
Posts: 44

Rep: Reputation: 15
problem in received packet


Hello,
I am learning the skbuff workings in kenrel for that I added a fake header in TCP/IP with Fake header containing 2 fields of type int ipchksum and tcpchksum taken frpm upper layer and only copied to new header. I directly push it after IP header is added and thus sending packets to destination pc. At
destination side i am able to receive application data(payload) indeed correctly in FTP transfer but when i try to print faker header fields in kernel they are not printed rather gives OOPS message
I am really stuck at this point please help me.
Thanks in advance.
regards,
linux_lover.
 
Old 04-24-2005, 07:44 PM   #2
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
How is your printf statement like? It is possible that you have used wrong format string. e.g. %s for an integer value...
 
Old 04-24-2005, 08:33 PM   #3
linux_lover2005
Member
 
Registered: Dec 2004
Posts: 44

Original Poster
Rep: Reputation: 15
i have netfilter kernel module at NF_IP_POST_ROUTING at which i added netfilter hook that pushes new fake header after IP header is skb_put in ip_output.c file.
i did some changes to implementation by changing header values as
struct fake{
char *name;
int num;
}; /*inserted this in skbuff struct*/
In netfilter module i am just assigning values. Then packet is filled with Hardware header. I want to work this on network but right now using 2 computers.
Actually the problem is to retreive header from skb->data. As we know each header is mapped to union raw character format in netif_receive_skb. I dont have union defined in skbuff. i tried that one but not worked as my header position is in between Ethernet and IP.
I am doing
fake=skb->fakehdr;
printk(KERN_DEBUG "my name = %s\n", fake->name);
printk(KERN_DEBUG "num is = %d\n", fake->num);
kernel oops here as i think it is not getting corret pointer in skb->data for new fake header?
please help me if you need any more info please ask me. Theres only i think pointer problem that i am not able to set.
 
  


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
Packet Filter to redirect a packet to a user level process akawale Linux - Networking 3 09-01-2006 12:06 PM
how do i read the data in the packet that i have captured after packet capture? gajaykrishnan Programming 23 04-19-2006 05:09 AM
packet fragmentation in packet forwarding code cranium2004 Linux - Networking 0 05-16-2005 04:05 AM
port 80 problem no connection are received gt73 Programming 1 11-13-2003 03:42 AM
Suggestions for packet sniffer w/ packet viewing? TruckStuff Linux - Networking 5 05-31-2002 09:50 AM

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

All times are GMT -5. The time now is 06:39 PM.

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