LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 02-25-2011, 03:25 AM   #1
kalloc
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Rep: Reputation: 0
NETFILTER and Extraction of data from non linear area of skbuff


i am writing a netfilter module for linux 2.6.34.6-47 / 2.6.35. while i could capture the packets on the incoming hook since the same came as a single packet in probably the allocated skbuff area by the stack, i found that packets going out of the machine are getting splitted into linear and non-linear area. skb->data gives the total length of packet as correct, but when i extract skb-> data to print it, it prints only ip and tcp header. Now to treat the data i need to extract it and then push it back on the route.

To clarify if my data is 3 bytes . the total length by passing pointers is shown as 55 bytes = ( 52 byte of header + 3 byte of data), but i can't access these 3 bytes by using (skb->tail - skb->data), what i see is only header bytes. can some one please give some hint how to extract outgoing data for any further action and then put it back on route for further encapsulation by the L2 stack or whatever... where are those 3 bytes or application layer packets stored, how to access them to treat them before allowing them to go ahead in the route

will skb_linearize() or skb_linearize_cow() be of any use , if yes how and why. ?
thx in advance
 
Old 03-01-2011, 02:15 PM   #2
nini09
Member
 
Registered: Apr 2009
Posts: 505

Rep: Reputation: 41
What happen when you access 3 bytes by using skb->tail - skb->data?
 
Old 03-02-2011, 12:36 AM   #3
kalloc
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Original Poster
Rep: Reputation: 0
Nothing great in 3 bytes :)

You can access the application layer payload. then play around with it to your imagination. it could be 3 bytes or more or less. 3 byte was just used as example for easy understanding of the problem.
Quote:
Originally Posted by nini09 View Post
What happen when you access 3 bytes by using skb->tail - skb->data?
 
  


Reply

Tags
kernel module, netfilter, netfilter modules, pages, skbuff


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tcp_header=(struct tcphdr *)(skbuff->data+(skbuff->nh.iph->ihl*4)); How? iamjayanth Linux - Kernel 4 02-25-2011 04:07 AM
NETFILTER and Extraction of data from non linear area of skbuff kalloc Linux - Networking 1 02-25-2011 03:26 AM
problem with netfilter hook function struct skbuff *sock is null.. pavan6754 Programming 1 11-30-2009 05:42 AM
LXer: Linear Optimization with the GNU Linear Programming Kit LXer Syndicated Linux News 0 08-12-2006 04:21 AM
pcap data extraction black_man Linux - Networking 1 08-28-2004 08:52 AM


All times are GMT -5. The time now is 12:40 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration