Rather than calling mircotime() in catchpacket(), make catchpacket()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Jul 2006 09:39:27 +0000 (09:39 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 30 Jul 2006 09:39:27 +0000 (09:39 +0000)
commitaedcf384bff416d37094d3a5d5316b19b1f86667
treed72a57ba301f03d0f9bafda7475e7f8546186e0c
parentbdddf84912ce07f6d895698c380c261a4395b019
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