Link to home
Start Free TrialLog in
Avatar of iemonslice
iemonslice

asked on

Is there way to obtain the precise time when a UDP packet *arrives*?

Is there way to obtain the precise time when a UDP packet *arrives*? By arrives I mean the exact time it gets buffered in the receive queue and NOT the time when I do a recv()/recvfrom().
Avatar of sunnycoder
sunnycoder
Flag of India image

You can get it from the sk_buff kernel data structure for the packet that arrived ... the
struct timeval      stamp;
has exactly what you are looking for ...

you can find the struct definition in include/linux/Skbuff.c
Avatar of iemonslice
iemonslice

ASKER

Kernel data structure? Am I able to access it from user space? If it can be accessed, how would I obtain that value?
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi iemonslice,

I came across this new How-to
http://www.iptables.org/documentation/HOWTO//netfilter-hacking-HOWTO-4.html

It seems that it is possible to do some packet handling in user space using libipq ... There is a section devoted to libipq in this how-to .. I am not sure if it would allow access to skb from user space, but still go through it