summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-06-10 23:48:21 +0000
committerdlg <dlg@openbsd.org>2019-06-10 23:48:21 +0000
commit9f78c7ff9bbb70b9cc0719cf32120a4d62b8defc (patch)
tree3f27e34226cfde821a696212770eb16d81b4f547
parentadd m_microtime for getting the wall clock time associated with a packet (diff)
downloadwireguard-openbsd-9f78c7ff9bbb70b9cc0719cf32120a4d62b8defc.tar.xz
wireguard-openbsd-9f78c7ff9bbb70b9cc0719cf32120a4d62b8defc.zip
use m_microtime instead of microtime for SO_TIMESTAMP socketopt handling
drivers can set ph_timestamp when packets are received by the hardware, which should be more accurate and cheaper than getting the clock when the packet is queued on the socket.
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet6/ip6_input.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 30e7a2c71eb..d4d4c5b72cd 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.342 2018/10/13 18:36:01 florian Exp $ */
+/* $OpenBSD: ip_input.c,v 1.343 2019/06/10 23:48:21 dlg Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1712,7 +1712,7 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
if (inp->inp_socket->so_options & SO_TIMESTAMP) {
struct timeval tv;
- microtime(&tv);
+ m_microtime(m, &tv);
*mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv),
SCM_TIMESTAMP, SOL_SOCKET);
if (*mp)
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 310e53b4257..d9c4b356a73 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.216 2018/11/09 14:14:32 claudio Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.217 2019/06/10 23:48:22 dlg Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -947,7 +947,7 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
if (in6p->inp_socket->so_options & SO_TIMESTAMP) {
struct timeval tv;
- microtime(&tv);
+ m_microtime(m, &tv);
*mp = sbcreatecontrol((caddr_t) &tv, sizeof(tv),
SCM_TIMESTAMP, SOL_SOCKET);
if (*mp)