LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-12-2006, 11:45 PM   #1
alok_sethi
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Rep: Reputation: 0
netfilter and pskb


Hi all
using net filter when i try to access the address of udp header using
temp =(__u32 *) ((*pskb)->h.uh)

and when i try to access the same address using data pointer

temp=(__u32 *)(*pskb)->data;
temp+=5;

value of temp in both cases comes out to be different.

in the second case the value returned by *temp is the correct udp header
but the value returned by *temp in first case is not correct

can some one please help me to find out what i am doing wrong
thanks

regards
alok
 
Old 03-14-2006, 05:09 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Try to print both values (addresses). My guess (a good one) is that (*pskb)->h.uh will give you a pointer to the beginning of the IP header. The thing is that h in sk_buff is an union. It has more possibilities than only uh. You should calculate the offset on your own. Remember, however, that just adding 5 may not be the right way to go if there are IP options (it's very rare but may happen). Use the value from IP header instead.
 
  


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
Do I really need a netfilter/firewall? Trijicon Linux - Security 6 10-15-2005 04:58 PM
netfilter query cranium2004 Linux - Networking 1 11-21-2004 12:51 PM
Netfilter / IPtables SWAT Linux - Newbie 3 11-11-2003 09:04 AM
IPCHAINS or NETFILTER? cottonmouth Linux - Networking 1 11-18-2002 03:54 PM
Netfilter Questions jrmann1999 Linux - Networking 0 06-29-2001 07:32 PM

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

All times are GMT -5. The time now is 05:14 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