From patchwork Wed Jul 7 09:27:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 471167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50751C07E9E for ; Wed, 7 Jul 2021 09:35:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DB5F61CC0 for ; Wed, 7 Jul 2021 09:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbhGGJho (ORCPT ); Wed, 7 Jul 2021 05:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbhGGJhn (ORCPT ); Wed, 7 Jul 2021 05:37:43 -0400 X-Greylist: delayed 435 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 07 Jul 2021 02:35:04 PDT Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 209CBC061574; Wed, 7 Jul 2021 02:35:04 -0700 (PDT) Received: by sf.home (Postfix, from userid 1000) id 52CD42EEC616; Wed, 7 Jul 2021 10:27:41 +0100 (BST) From: Sergei Trofimovich To: netdev@vger.kernel.org, Florian Westphal , "David S . Miller" Cc: linux-kernel@vger.kernel.org, Sergei Trofimovich , Paolo Abeni , Mat Martineau , Jakub Kicinski , Eric Dumazet Subject: [PATCH] net: core: fix SO_TIMESTAMP_* option setting Date: Wed, 7 Jul 2021 10:27:31 +0100 Message-Id: <20210707092731.2499-1-slyfox@gentoo.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 CC: Florian Westphal CC: Mat Martineau CC: David S. Miller CC: Jakub Kicinski CC: Eric Dumazet Signed-off-by: Sergei Trofimovich --- 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: