All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: core: fix SO_TIMESTAMP_* option setting
@ 2021-07-07  9:27 Sergei Trofimovich
  2021-07-07 12:32 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Trofimovich @ 2021-07-07  9:27 UTC (permalink / raw)
  To: netdev, Florian Westphal, David S . Miller
  Cc: linux-kernel, Sergei Trofimovich, Paolo Abeni, Mat Martineau,
	Jakub Kicinski, Eric Dumazet

I noticed the problem as a systemd-timesyncd (and ntpsec) sync failures:

    systemd-timesyncd[586]: Timed out waiting for reply from ...
    systemd-timesyncd[586]: Invalid packet timestamp.

Bisected it down to commit 371087aa476
("sock: expose so_timestamp options for mptcp").

The commit should be a no-op but it accidentally reordered option type
and option value:

    +void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
    ...
    -     __sock_set_timestamps(sk, valbool, true, true);
    +     sock_set_timestamp(sk, valbool, optname);

Tested the fix on systemd-timesyncd. The sync failures went away.

CC: Paolo Abeni <pabeni@redhat.com>
CC: Florian Westphal <fw@strlen.de>
CC: Mat Martineau <mathew.j.martineau@linux.intel.com>
CC: David S. Miller <davem@davemloft.net>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Eric Dumazet <edumazet@google.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 net/core/sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index ba1c0f75cd45..060892372ac5 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1068,7 +1068,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
 	case SO_TIMESTAMP_NEW:
 	case SO_TIMESTAMPNS_OLD:
 	case SO_TIMESTAMPNS_NEW:
-		sock_set_timestamp(sk, valbool, optname);
+		sock_set_timestamp(sk, optname, valbool);
 		break;
 
 	case SO_TIMESTAMPING_NEW:
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: core: fix SO_TIMESTAMP_* option setting
  2021-07-07  9:27 [PATCH] net: core: fix SO_TIMESTAMP_* option setting Sergei Trofimovich
@ 2021-07-07 12:32 ` Eric Dumazet
  2021-07-07 14:20   ` Sergei Trofimovich
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2021-07-07 12:32 UTC (permalink / raw)
  To: Sergei Trofimovich
  Cc: netdev, Florian Westphal, David S . Miller, LKML, Paolo Abeni,
	Mat Martineau, Jakub Kicinski

On Wed, Jul 7, 2021 at 11:27 AM Sergei Trofimovich <slyfox@gentoo.org> wrote:
>
> I noticed the problem as a systemd-timesyncd (and ntpsec) sync failures:
>
>     systemd-timesyncd[586]: Timed out waiting for reply from ...
>     systemd-timesyncd[586]: Invalid packet timestamp.
>
> Bisected it down to commit 371087aa476
> ("sock: expose so_timestamp options for mptcp").
>
> The commit should be a no-op but it accidentally reordered option type
> and option value:
>
>     +void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
>     ...
>     -     __sock_set_timestamps(sk, valbool, true, true);
>     +     sock_set_timestamp(sk, valbool, optname);
>
> Tested the fix on systemd-timesyncd. The sync failures went away.
>
> CC: Paolo Abeni <pabeni@redhat.com>
> CC: Florian Westphal <fw@strlen.de>
> CC: Mat Martineau <mathew.j.martineau@linux.intel.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Jakub Kicinski <kuba@kernel.org>
> CC: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---

I think this has been fixed five days ago in

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=81b4a0cc7565b08cadd0d02bae3434f127d1d72a

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: core: fix SO_TIMESTAMP_* option setting
  2021-07-07 12:32 ` Eric Dumazet
@ 2021-07-07 14:20   ` Sergei Trofimovich
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Trofimovich @ 2021-07-07 14:20 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, Florian Westphal, David S . Miller, LKML, Paolo Abeni,
	Mat Martineau, Jakub Kicinski

On Wed, 7 Jul 2021 14:32:01 +0200
Eric Dumazet <edumazet@google.com> wrote:

> On Wed, Jul 7, 2021 at 11:27 AM Sergei Trofimovich <slyfox@gentoo.org> wrote:
> >
> > I noticed the problem as a systemd-timesyncd (and ntpsec) sync failures:
> >
> >     systemd-timesyncd[586]: Timed out waiting for reply from ...
> >     systemd-timesyncd[586]: Invalid packet timestamp.
> >
> > Bisected it down to commit 371087aa476
> > ("sock: expose so_timestamp options for mptcp").
> >
> > The commit should be a no-op but it accidentally reordered option type
> > and option value:
> >
> >     +void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
> >     ...
> >     -     __sock_set_timestamps(sk, valbool, true, true);
> >     +     sock_set_timestamp(sk, valbool, optname);
> >
> > Tested the fix on systemd-timesyncd. The sync failures went away.
> >
> > CC: Paolo Abeni <pabeni@redhat.com>
> > CC: Florian Westphal <fw@strlen.de>
> > CC: Mat Martineau <mathew.j.martineau@linux.intel.com>
> > CC: David S. Miller <davem@davemloft.net>
> > CC: Jakub Kicinski <kuba@kernel.org>
> > CC: Eric Dumazet <edumazet@google.com>
> > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> > ---  
> 
> I think this has been fixed five days ago in
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=81b4a0cc7565b08cadd0d02bae3434f127d1d72a

Aha, looks good! Thank you!

-- 

  Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-07 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  9:27 [PATCH] net: core: fix SO_TIMESTAMP_* option setting Sergei Trofimovich
2021-07-07 12:32 ` Eric Dumazet
2021-07-07 14:20   ` Sergei Trofimovich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.