Skip to content
Snippets Groups Projects
Commit 5053858e authored by Michael Tüxen's avatar Michael Tüxen
Browse files
parent 9de700fe
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,8 @@ static void bind_to_interface(int fd, int interface_index)
*/
static void packet_socket_setup(struct packet_socket *psock)
{
struct timeval tv;
psock->packet_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock->packet_fd < 0)
die_perror("socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))");
......@@ -92,6 +94,12 @@ static void packet_socket_setup(struct packet_socket *psock)
bind_to_interface(psock->packet_fd, psock->index);
set_receive_buffer_size(psock->packet_fd, PACKET_SOCKET_RCVBUF_BYTES);
/* Pay the non-trivial latency cost to enable timestamps now, before
* the test starts, to avoid significant delays in the middle of tests.
*/
ioctl(psock->packet_fd, SIOCGSTAMP, &tv);
}
/* Add a filter so we only sniff packets we want. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment