Rather than calling mircotime() in catchpacket(), make catchpacket()
commit3eb548d819a33b2fccfed63b35666faeaa95265c
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Jul 2006 09:39:27 +0000 (30 09:39 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Jul 2006 09:39:27 +0000 (30 09:39 +0000)
tree1c0eaac4c090b920bac928fc0b18a3e8d18b75cd
parent2df436a33cb859811b0fdeb2fc2cd9366448f506
Rather than calling mircotime() in catchpacket(), make catchpacket()
take a timeval indicating when the packet was captured. Move
microtime() to the calling functions and grab the timestamp as soon
as we know that we're going to call catchpacket at least once.

This means that we call microtime() once per matched packet, as
opposed to once per matched packet per bpf listener. It also means
that we return the same timestamp to all bpf listeners, rather than
slightly different ones.

It would be more accurate to call microtime() even earlier for all
packets, but microtime() can be costly, so this didn't seem like a good idea.

Obtained-from: FreeBSD (dwmalone@freebsd.org)
Remined-and-Reviewed-by: joerg
sys/net/bpf.c