Is the time obtained by the pcap_next_ex function in libpcap the hard timestamp of the network card? If not, how to obtain the hard timestamp when the packet is received pcap_next_ex(pcap_t* p,struct pcap_pkthdr** pkt_header,const u_char** pkt_data)
Obtain hardware timestamp
1.1k Views Asked by Junsheng Shen At
1
There are 1 best solutions below
Related Questions in NETWORKING
- kernel module does not print packet info
- Packet drops in multicast when multiple instance of listner are running
- Timing packets on a traffic server
- How to use Espresso Idling Resource for network calls
- Dummynet does not match on flows
- Sending a notification from OS X to iOS
- Swift ios viewDidLoad or viewDidAppear
- Update player list on all clients on new connection
- Issues regarding multiplayer networking: input
- nmap does not show all open ports
- Getting and Sending Data between a Server and Client
- Read file from local PC from network deployed app to InputStream
- Does iOS block a URL if we couldn't connect to the URL for 'n' times?
- Is Socket.Available guaranteed to throw a SocketException on disconnect?
- android out of cell service
Related Questions in TIMESTAMP
- Accelerator data analysis once per second
- How to get the time stamp of each frame of a GoPro video in MATLAB?
- CURRENT_TIMESTAMP in milliseconds in h2
- keep timezone "CET" from convert into "CEST" in python
- PHP timestamp and dates issue
- how to write mysql error and out log with timestamp
- Youtube embed display at one time start at beginning
- Span SQL Rows over time
- Convert timestamp into time()
- List files and timestamp of creation on AIX system (Perl)
- MySQL time and attendance "parse filter" type and status
- How can I format my timestamp right?
- Adding timestamp and custom name to a File uploaded via PHP
- Break Javascript array of timestamps into smaller arrays by hour, day
- How do I find the time difference between two timestamps?
Related Questions in LIBPCAP
- Are Berkeley Packet Filter opcode values implementation defined?
- Merging two pcap files with libpcap
- pcap_dispatch() always returns 0 on Mac OSX for wifi interface
- Performing TCP connections automatically with libpcap
- Writing pcap packets into a structure with libpcap
- Querying Interfaces to find device with libpcap
- Capture RRC Messages using Libpcap on android
- Finding host address range in C
- Set timeout to unresponded hosts in ARP request with libpcap
- ladvd and libpcap installation?
- How to Match a URL in UDP payload using POSIX regexec and libpcap in C
- Pcap functions have "undefined reference"
- How to install Python libpcap module on Mac OS X
- How can I merge 'split/partial' packets with libpcap?
- Programming with pcap example
Related Questions in IOCTL
- unknown field 'ioctl' specified in initializer
- How to share same header files between kernel modules and userspace applications.
- Linux I2C-Dev IOCTL-Call produces wrong message
- python library to access low-level detail of drive (SMART, scsi generic, ata security, etc)
- Incomplete type 'struct ifmediareq' (ioctl)
- Why does my program not populate the array with pixel values?
- Where is userspace wrapper for ioctl system call defined on x86_64 Linux?
- Confusion on TUNSETIFF ioctl type
- Communicating kernel space from user-land in Windows
- Access a raw disk in Random Access mode C++
- DeviceIoControl is totally not working, SystemBuffer empty on return
- how to attach to a TAP interface from two different processes
- Setting private ioctls without iwpriv
- Python - How can I read input from a device using ioctl or spidev?
- Write Text and command keys to a TTY on Linux
Related Questions in TIMEVAL
- How to write a macro which gets runtime of a function?
- Get time_t / timeval corresponding to ( local_timezone ) midnight on a given date
- how to calculate milliseconds using timeval structure?
- choose between timeval and clock() to calculate elapsed time in C
- convert timeval structure to c#
- How getrusage works and What is really inside the rusage struct?
- Switching between statements if the user inputs something: infinitely and with a timeout
- Mismatch in timing
- How do I double timeval in C?
- Is there a standard way to convert a struct timeval into a struct timespec?
- How do I compare two timestamps in C?
- timeval undefined when using windows.h and WIN32_LEAN_AND_MEAN
- Obtain hardware timestamp
- Add or subtract an interval from a timeval
- Porting time APIs from Linux to Visual Studio 2008
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Only if the code path that delivers packets to libpcap gets a timestamp from the network card and provides it.
Currently, the only operating system on which libpcap provides an option to get hardware timestamps on regular network interfaces is Linux, but that's not the default; by default, packets get the standard Linux networking stack time stamp, which is generated by the OS when the packet is processed.
Some specialized devices, where libpcap doesn't use the regular networking stack to get packets, might provide hardware time stamps. That might be the case for Endace DAG cards, but I don't know whether that's the case.
You will need to use the new
pcap_create()/pcap_activate()API, rather than the oldpcap_open_live()API, to open the adapter.After calling
pcap_create(), callpcap_list_tstamp_types(); it will return a list of time stamp types supported by the adapter and OS. If eitherPCAP_TSTAMP_ADAPTERorPCAP_TSTAMP_ADAPTER_UNSYNCEDare available, you will want to make libpcap use one of those. To do so, usepcap_set_tstamp_type()to set the time stamp type before callingpcap_activate().NOTE: the time stamps you get might not be represented as seconds that have elapsed since January 1, 1970, 00:00:00 UTC; they might differ from that value by a few seconds (whatever the difference was between TAI and UTC at some point in time - I'd have to check the Precision Time Protocol spec to see what that offset is). This Is A Bug, and I will try to fix it at some point, if there's a way to determine whether adapter-supplied time stamps in Linux are based on the UN*X epoch or on some TAI epoch.