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().
iemonsliceAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sunnycoderConnect With a Mentor Commented:
No, you cannot access it from user space ... you need to register a kernel module with NF_IP_LOCAL_IN hook provided with netfilter framework

I think tcpdump or ethereal should also provide timestamp information ... try them
0
 
sunnycoderCommented:
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
0
 
iemonsliceAuthor Commented:
Kernel data structure? Am I able to access it from user space? If it can be accessed, how would I obtain that value?
0
 
sunnycoderCommented:
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
0
All Courses

From novice to tech pro — start learning today.