From 995b989cb216e2260e7cdf2b14a36ad0c9f15f13 Mon Sep 17 00:00:00 2001 From: mlelstv Date: Sat, 24 Feb 2024 21:41:13 +0000 Subject: [PATCH] Deliver timestamps also to raw sockets. Fixes PR 57955 --- sys/netinet6/icmp6.c | 10 ++++++---- sys/netinet6/raw_ip6.c | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 846581235b44..1954a5cfe1c9 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $NetBSD: icmp6.c,v 1.255 2023/12/09 15:21:02 pgoyette Exp $ */ +/* $NetBSD: icmp6.c,v 1.256 2024/02/24 21:41:13 mlelstv Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.255 2023/12/09 15:21:02 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.256 2024/02/24 21:41:13 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1987,7 +1987,8 @@ icmp6_rip6_input(struct mbuf **mp, int off) } #endif else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) { - if (last->inp_flags & IN6P_CONTROLOPTS) + if (last->inp_flags & IN6P_CONTROLOPTS || + SOOPT_TIMESTAMP(last->inp_socket->so_options)) ip6_savecontrol(last, &opts, ip6, n); /* strip intermediate headers */ m_adj(n, off); @@ -2014,7 +2015,8 @@ icmp6_rip6_input(struct mbuf **mp, int off) } else #endif if (last) { - if (last->inp_flags & IN6P_CONTROLOPTS) + if (last->inp_flags & IN6P_CONTROLOPTS || + SOOPT_TIMESTAMP(last->inp_socket->so_options)) ip6_savecontrol(last, &opts, ip6, m); /* strip intermediate headers */ m_adj(m, off); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index d070d3b8ed79..c5d27b7429c9 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip6.c,v 1.183 2023/03/22 03:17:18 ozaki-r Exp $ */ +/* $NetBSD: raw_ip6.c,v 1.184 2024/02/24 21:41:13 mlelstv Exp $ */ /* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.183 2023/03/22 03:17:18 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.184 2024/02/24 21:41:13 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -140,7 +140,8 @@ rip6_sbappendaddr(struct inpcb *last, struct ip6_hdr *ip6, { struct mbuf *opts = NULL; - if (last->inp_flags & IN6P_CONTROLOPTS) + if (last->inp_flags & IN6P_CONTROLOPTS || + SOOPT_TIMESTAMP(last->inp_socket->so_options)) ip6_savecontrol(last, &opts, ip6, n); m_adj(n, hlen);