224c697f91
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, as you have to grab (1+#listener) locks before you can determine if the packet will be logged. You could always grab a timestamp before the locks, but microtime() can be costly, so this didn't seem like a good idea. (I guess most ethernet interfaces will have a bpf listener these days because of dhclient. That means that we could be doing two bpf locks on most packets going through the interface.) |
||
---|---|---|
.. | ||
agr | ||
bpf_filter.c | ||
bpf.c | ||
bpf.h | ||
bpfdesc.h | ||
bridgestp.c | ||
bsd-comp.c | ||
dlt.h | ||
ethertypes.h | ||
files.pf | ||
if_arc.h | ||
if_arcsubr.c | ||
if_arp.h | ||
if_atm.h | ||
if_atmsubr.c | ||
if_bridge.c | ||
if_bridgevar.h | ||
if_dl.h | ||
if_eco.h | ||
if_ecosubr.c | ||
if_ether.h | ||
if_ethersubr.c | ||
if_faith.c | ||
if_faith.h | ||
if_fddi.h | ||
if_fddisubr.c | ||
if_gif.c | ||
if_gif.h | ||
if_gre.c | ||
if_gre.h | ||
if_hippi.h | ||
if_hippisubr.c | ||
if_ieee1394.h | ||
if_ieee1394subr.c | ||
if_llc.h | ||
if_loop.c | ||
if_media.c | ||
if_media.h | ||
if_ppp.c | ||
if_ppp.h | ||
if_pppoe.c | ||
if_pppoe.h | ||
if_pppvar.h | ||
if_sl.c | ||
if_slvar.h | ||
if_sppp.h | ||
if_spppsubr.c | ||
if_spppvar.h | ||
if_stf.c | ||
if_stf.h | ||
if_strip.c | ||
if_stripvar.h | ||
if_tap.c | ||
if_tap.h | ||
if_token.h | ||
if_tokensubr.c | ||
if_tun.c | ||
if_tun.h | ||
if_types.h | ||
if_vlan.c | ||
if_vlanvar.h | ||
if.c | ||
if.h | ||
Makefile | ||
net_osdep.h | ||
netisr_dispatch.h | ||
netisr.h | ||
pfil.c | ||
pfil.h | ||
pfkeyv2.h | ||
ppp_defs.h | ||
ppp_tty.c | ||
ppp-comp.h | ||
ppp-deflate.c | ||
radix.c | ||
radix.h | ||
raw_cb.c | ||
raw_cb.h | ||
raw_usrreq.c | ||
route.c | ||
route.h | ||
rtsock.c | ||
slcompress.c | ||
slcompress.h | ||
slip.h | ||
zlib.c | ||
zlib.h |