From patchwork Mon Nov 2 22:30:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875469 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 EF71FC388F9 for ; Mon, 2 Nov 2020 22:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F75D22384 for ; Mon, 2 Nov 2020 22:31:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZezBtPSf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgKBWbR (ORCPT ); Mon, 2 Nov 2020 17:31:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgKBWbQ (ORCPT ); Mon, 2 Nov 2020 17:31:16 -0500 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8CFEC0617A6 for ; Mon, 2 Nov 2020 14:31:14 -0800 (PST) Received: by mail-qk1-x749.google.com with SMTP id x85so9724377qka.14 for ; Mon, 02 Nov 2020 14:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=jNpZYdfA2v8kViHg5yyabr+u6XDxnMcDU78apOksAVo=; b=ZezBtPSfrJY6Udt+EzqghhK6FsRrq6DTTWTuiXVUDSQ07975bV0GW99wtnxTOo9lcI 1rDJBYaHzmWFOIxFOk2VDw2NOA3554j2u8vu/75OnGcHEVz9eEcMefrlibacucdV/oyD c5j3FC+Oe/8kFbi05Pbn6qMceW2OPe2WBEtS2Xd4x214WJpBosxHASM36SdQmv7cKae+ BWiGodFtXvzigG8wzcvFFy5DEOr/4Q+Hd8pTiwSaSZQ6OMfl0uxZNbTifetwc294CQOd 6eG14mAJUV4P9Sdbf4wRD971cN1CGdEhAhbdvBg9e3KE5m2TUipcpfhpDWr2a87C8DR7 /pkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=jNpZYdfA2v8kViHg5yyabr+u6XDxnMcDU78apOksAVo=; b=GRkrx4OJ5AL+elPtEvVSsreSRShjrIxsJQ42ijBAoUvK4rwPoYG2+VZhDso7Wct6W2 KM+iC+biC2hDhQlizkQumEkqlrmRAyRK7Gg4gMLMLQsYJWUcpo0OhVi8+hWvDUspf1fm +hp/ARSKCWB38sJxsgV0nVQpyNiHpQ0JBZj8MO7C/jBiLwgOy9v8rED7V/H6Tisw+oAS yuN2tnNoTDvlHGjeLklCYZP5vA/DQgFVX2tQ+OJAaR/P9mB7fwNQ4ivcErYVhPXb58Ig FFttZENmmG6h1jYliU2a7DIBvTaZ+CojXN7SqrWuaDspSEw2v+a6IeWm6otZSZNeP2TK BCwg== X-Gm-Message-State: AOAM530OHUITQrVJMaYL/cJRd9s9vdg07UqCsHphppR+rsdwzFW68RNx +0YnddW2aiP+aATaQ9rLPbYl0iFVIYeEsXbS7G118t0An0NcKVbh2ZcnN9eGynO+3ROd52MyK7K Uw1hBkxC7RFjp9pOg3vXxNDSFGZ9At2LvEK1D7ZuOLdW4UIRRTAMvuMqVZJ/dswY= X-Google-Smtp-Source: ABdhPJwwBsT8dadNhwZdY1vFfxrnS7jDfU5Kt9XVkTXJZpyCMQvaaVi461sTqCM/3QMaw2Lse59mljhOS+8mIw== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a0c:cb02:: with SMTP id o2mr23714823qvk.8.1604356273789; Mon, 02 Nov 2020 14:31:13 -0800 (PST) Date: Mon, 2 Nov 2020 14:30:59 -0800 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 01/11] docs: new capability to advertise trace2 SIDs From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In future patches, we will add the ability for Git servers and clients to advertise their trace2 session IDs via protocol capabilities. This allows for easier debugging when both client and server logs are available. Signed-off-by: Josh Steadmon --- Documentation/technical/protocol-capabilities.txt | 13 +++++++++++-- Documentation/technical/protocol-v2.txt | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/technical/protocol-capabilities.txt b/Documentation/technical/protocol-capabilities.txt index ba869a7d36..73d4ee7f27 100644 --- a/Documentation/technical/protocol-capabilities.txt +++ b/Documentation/technical/protocol-capabilities.txt @@ -27,8 +27,8 @@ and 'push-cert' capabilities are sent and recognized by the receive-pack (push to server) process. The 'ofs-delta' and 'side-band-64k' capabilities are sent and recognized -by both upload-pack and receive-pack protocols. The 'agent' capability -may optionally be sent in both protocols. +by both upload-pack and receive-pack protocols. The 'agent' and 'trace2-sid' +capabilities may optionally be sent in both protocols. All other capabilities are only recognized by the upload-pack (fetch from server) process. @@ -365,3 +365,12 @@ If the upload-pack server advertises the 'filter' capability, fetch-pack may send "filter" commands to request a partial clone or partial fetch and request that the server omit various objects from the packfile. + +trace2-sid= +----------------------- + +If trace2 tracing is enabled on the server, it may advertise its session ID via +this capability. The client may choose to log the server's session ID in its +trace logs, and advertise its own session ID back to the server for it to log +as well. This allows for easier debugging of remote sessions when both client +and server logs are available. diff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt index e597b74da3..a5b9ef04f6 100644 --- a/Documentation/technical/protocol-v2.txt +++ b/Documentation/technical/protocol-v2.txt @@ -492,3 +492,12 @@ form `object-format=X`) to notify the client that the server is able to deal with objects using hash algorithm X. If not specified, the server is assumed to only handle SHA-1. If the client would like to use a hash algorithm other than SHA-1, it should specify its object-format string. + +trace2-sid= +~~~~~~~~~~~~~~~~~~~~~~~ + +If trace2 tracing is enabled on the server, it may advertise its session ID via +this capability. The client may choose to log the server's session ID in its +trace logs, and advertise its own session ID back to the server for it to log +as well. This allows for easier debugging of remote sessions when both client +and server logs are available. From patchwork Mon Nov 2 22:31:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875459 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 59108C00A89 for ; Mon, 2 Nov 2020 22:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 039C622275 for ; Mon, 2 Nov 2020 22:31:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IpRv4xXb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbgKBWbR (ORCPT ); Mon, 2 Nov 2020 17:31:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgKBWbQ (ORCPT ); Mon, 2 Nov 2020 17:31:16 -0500 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953D6C061A47 for ; Mon, 2 Nov 2020 14:31:16 -0800 (PST) Received: by mail-qt1-x84a.google.com with SMTP id 22so5462940qtp.9 for ; Mon, 02 Nov 2020 14:31:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=Y6MHdBdPxqowdqb96wr1JWEY0Xk0KmoTvIXiei+qIyg=; b=IpRv4xXbalnbNfzJymaX0bDglImMgd27UBTYpB91YJ3Smfa1CLV0CJlgTEHPLr/JK+ 5EUcGI3PNZNFi6vzNTkB1rf317ZYDCc63V2dJ+B1Xa1O/p833kGcTQ4BU7RV6Kn8fbk7 gA0uKeKdTALM2vroahbeY+xkKTc6mOUWasca4OwnPlVfyuvmERgcNFGbbjwxMm3UvYKV aDjW2OWpaEIvTiaRW8VY+LAWhma6IkO1VDwgM2l3Hnli/PRTAyIaLvyy9GMPhdDuNBIk 1+7oR9Swpe/xIJpjywJ7+H1PAuecxQVgRtsXWJhDETbx/Rogr+SMYLDE31qcDHdSXpqF /KbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=Y6MHdBdPxqowdqb96wr1JWEY0Xk0KmoTvIXiei+qIyg=; b=GGurL2uhwb3ulMaLXOCgp6FYDxLFFA36oFsHRYUYUCc14UQdt5HQwX/yu8Dux1ExtH 4CIrx53znLBvQ0lornv95K0edq8K7OOPvarncVj5aUhmyJJtB6UdCZ9sxVCFhgx/t5Zl Q3WMXqPjOKetPc/WIO9088NaLIy5OmERcyFqDdPUBKYMcQBVAEnK6H5S4j0V08HIS1l+ 3RFdmQ6xGlRt+RN3d4+0eBEsm7h7t7pLQaVYeVH/fjicgtiHk/SnP7pv3XOv++Go/dhx G3yb6s7wCGzxR/a7zYd/+90JamxIdmV/hdE+kCkdXS7YvoHIz9bNu2fMPq+t0uVTda+2 YZeA== X-Gm-Message-State: AOAM533Bf3vlUeKPrE2uAmFMq0yZGoMLZoN1LT4IVLWejM2fjPGgHiwW /hOLnE7r+O6Ki/rwZLW53Um/H4ltl/XQvjuqYKIP5LRUDGQEb3iMCqz4AwwEd4haLGpxdP7zuoG 2DzzFa/HuFoC6WRxXdGjcR8SUuWZp1ZjIZKbXbF0IyQl7ebNTfUz7kOBFaUrmY9A= X-Google-Smtp-Source: ABdhPJwbJTp9UkPXTj1J8fdvTAicC9imkanRDJ//EMj76wpBcidgmJElp/n0IKM8lj9PHkiYv1ASwE0IqKllyg== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:ad4:5004:: with SMTP id s4mr16752928qvo.49.1604356275642; Mon, 02 Nov 2020 14:31:15 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:00 -0800 In-Reply-To: Message-Id: <5d5097b67109554e0763724633810ea616b5e2b2.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 02/11] docs: new trace2.advertiseSID option From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Document a new config option that allows users to determine whether or not to advertise their trace2 session IDs to remote Git clients and servers. Signed-off-by: Josh Steadmon --- Documentation/config/trace2.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/config/trace2.txt b/Documentation/config/trace2.txt index 01d3afd8a8..3f2e3b4425 100644 --- a/Documentation/config/trace2.txt +++ b/Documentation/config/trace2.txt @@ -69,3 +69,7 @@ trace2.maxFiles:: write additional traces if we would exceed this many files. Instead, write a sentinel file that will block further tracing to this directory. Defaults to 0, which disables this check. + +trace2.advertiseSID:: + Boolean. When true, client and server processes will advertise their + trace2 session IDs to their remote counterpart. Defaults to false. From patchwork Mon Nov 2 22:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875467 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 355FAC00A89 for ; Mon, 2 Nov 2020 22:31:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0B9322275 for ; Mon, 2 Nov 2020 22:31:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XrMh7dUY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbgKBWbU (ORCPT ); Mon, 2 Nov 2020 17:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgKBWbS (ORCPT ); Mon, 2 Nov 2020 17:31:18 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C52AC0617A6 for ; Mon, 2 Nov 2020 14:31:18 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id o135so15681807ybc.16 for ; Mon, 02 Nov 2020 14:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=mfxLg1Ne6Nr4HKL7QQys/sRXNZE+vPOcA/vW7FG1dLA=; b=XrMh7dUYqr+N2kUqRQBUgXIDMYZRm50IeYx20h2lLVOwTkIYf66qVJkRCrDVlkGIF1 J3C1GiOcHr8Tk4gPxZgpmHD+mDNMZGtkHkFXT2p1OeKfVWqgwVkBxuwBq+xpjb0O0cJ4 4bmed/KEcpcYb1esyGO4oneTbfTvyfhMseoqDEB3H7vcCGCNvQxQ33CneCAeMLFLpSK0 D0ITsuIz/ZiD1pEZospNtlMQoYplc25sr4CZz6Eo4cNVfwwuCX2UzW6qfzTsMst6ivuL wsDJPiNQT4iB+My4GYLCGP2Ps7WqIBpfD9YJAwTjlk25NM8tBXt9uHT3vL2BhpWLgUVG VsdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=mfxLg1Ne6Nr4HKL7QQys/sRXNZE+vPOcA/vW7FG1dLA=; b=jj6jMtVU0aJAfAx0u++LQXDN2+BxPIYK5js32rjxJlV4O07ObBhFgJzfsT6oxYj0us Wb2wYwIRMVWcc2YGDA9B+GJunpwwy0k11wTS0TEoZ2mJPPwfAYvYQXCWbB3oCxl/j/oI xJEVkeWj94rBp5dY8S31ICyaP+FwKf5nYpVYVDHIf42FMGjpKmgwBFqaqDrWIga08xSA Con7/NXdszMU8cjtp9dFNnySr+a3j5Io9fe1VVevkXYhogjaeZaMxuiPCyYUN/Dvpoqo OIFLLyg2CSxy16omSEWPIwq1OO2eFeZad/DchhkD8BesQElifeMx9VIoQXkOc95ylqhG 8reA== X-Gm-Message-State: AOAM530zeY9z/PL7GUZ32uuUIDLdGTnKFU2iJFflsfe7fZLmJOeie6MR FXamqnMQ7TXt8WMNncxiqu5z+ClATt5BXyIIv93H5IErSFcykArsMY6rjbFCh9q6pzq/5+rBXY3 tGskpwrw8hWwuTC370vukVOS5o4NOtKdDmG5Vi2BF+CcYa5U+W+2gllU6tZJk0Dw= X-Google-Smtp-Source: ABdhPJzdPQcDzmchyH4osi7nt/hRf4JzjWcAj0nvAEkVtUpBaFD51VbEsqgiRuWUM8TLhTTTRJtGS1L6iWC30A== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a5b:888:: with SMTP id e8mr23544998ybq.436.1604356277794; Mon, 02 Nov 2020 14:31:17 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:01 -0800 In-Reply-To: Message-Id: <7f42aacd2bbfdfe40b46bb024ec2eed2e61d027a.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 03/11] trace2: add a public function for getting the SID From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a public wrapper, trace2_session_id(), around tr2_sid_get(), which is intended to be private trace2 implementation. Signed-off-by: Josh Steadmon --- trace2.c | 5 +++++ trace2.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/trace2.c b/trace2.c index 2c6b570077..256120c7fd 100644 --- a/trace2.c +++ b/trace2.c @@ -792,3 +792,8 @@ void trace2_printf(const char *fmt, ...) va_end(ap); } #endif + +const char *trace2_session_id(void) +{ + return tr2_sid_get(); +} diff --git a/trace2.h b/trace2.h index b18bc5529c..ede18c2e06 100644 --- a/trace2.h +++ b/trace2.h @@ -500,4 +500,6 @@ void trace2_collect_process_info(enum trace2_process_info_reason reason); } while (0) #endif +const char *trace2_session_id(void); + #endif /* TRACE2_H */ From patchwork Mon Nov 2 22:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875455 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 33A69C388F9 for ; Mon, 2 Nov 2020 22:31:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1D5D22280 for ; Mon, 2 Nov 2020 22:31:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BBAYstPR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbgKBWbW (ORCPT ); Mon, 2 Nov 2020 17:31:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725833AbgKBWbV (ORCPT ); Mon, 2 Nov 2020 17:31:21 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28931C061A47 for ; Mon, 2 Nov 2020 14:31:20 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id 19so10138918pgq.18 for ; Mon, 02 Nov 2020 14:31:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=vy7mkvYBm7mdY0gYwpQpbvWIVN02epUA9FDKba3FbIU=; b=BBAYstPRY1EYdy0JlkNjRIaQlgzywqwnaWsb8dT3c8Y1JvQIOZbsGflILh+LhJftDS WyycZp3hYZfoJB0pRkgS6U0NqCvh3J52YGm1sgBZirhtmqsE9KOnfcsTeVtjrM5nFm/C C9kviHzrIoXphIVj/4WwW5ecZUeuBOIoCraIAd9/HMo7dEOZn4mQmt97gd0lXbUjUpV1 VgdEQuIprZJN2/WUSZAYSI68+fgdOBMSEege0tUBjPn7eLxXMwuyYZr9q3awhniQB++6 2MaY+Tenx019uL7ini1OrlL9ZUXkehPLnA9y8GM2uGKCxWYSxDqw8J31Eajrwiu2ql/u CCMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=vy7mkvYBm7mdY0gYwpQpbvWIVN02epUA9FDKba3FbIU=; b=JzV0q4De+uhNnU4HHWlUtPB6S/gkBqtYV+Ausy0yQF7GXOQEviGNPUhouhLhDNrPvf jhIDS1FLlFDiY6qMUzfeiWxPHZGndJ+uoFlqYjTusGCgD1tFXfFrtNNKbpgTJmhvQqPw ESPphcWW4a39BwENWAH2A63S4MQKExhyN4rf4ZV7SRH28Eaa+a75fKn8t1fyNJieO2HG 6otm5Ez+WqtKQP02VcgjnaAEC63F9PyZxFIh0hr487xSUb7GKk8X4jTIcgCrbuutQbjZ sdFM7OZzM+Ep3oLqUVxXnmNTfv+h54E2JsA2qztKQwzUeGz2Ypw5CXz/rptikWpwWWKu GoeQ== X-Gm-Message-State: AOAM533la50+Z5rBRzq/jXpu8rfbSM2cBzkv2TTiv+dBpeA4NFPYJED1 olZIpP/KI8kgAGU+hcskI6MTK4bEtgBCup5x4eRiQey/I0Ss8q4D7/XNvYLyyeT0daa9k3iTgX2 24IUTJrwYnbXRwCuebkhl+PWhU/BltJC8cIAjLHiMIXMAaWnQ04MVdqyA6TinBcY= X-Google-Smtp-Source: ABdhPJw0v1wvzyGGf3wwrVuVAu2cK2/Ah0iD4zGa1QdJf6KcNrTDpVsGJSo8CLcIZt++qZS4GLTWs5NHB6VxKg== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a17:90a:ab16:: with SMTP id m22mr350251pjq.219.1604356279596; Mon, 02 Nov 2020 14:31:19 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:02 -0800 In-Reply-To: Message-Id: <4912af5f2b949b9944b37843a9ebabdd33e66215.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 04/11] upload-pack: advertise trace2 SID in v0 capabilities From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled and trace2.advertiseSID is true, advertise upload-pack's trace2 session ID via the new trace2-sid capability. Signed-off-by: Josh Steadmon --- upload-pack.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/upload-pack.c b/upload-pack.c index 3b858eb457..3bb01c5427 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -110,6 +110,7 @@ struct upload_pack_data { unsigned done : 1; /* v2 only */ unsigned allow_ref_in_want : 1; /* v2 only */ unsigned allow_sideband_all : 1; /* v2 only */ + unsigned advertise_trace2_sid : 1; }; static void upload_pack_data_init(struct upload_pack_data *data) @@ -141,6 +142,7 @@ static void upload_pack_data_init(struct upload_pack_data *data) packet_writer_init(&data->writer, 1); data->keepalive = 5; + data->advertise_trace2_sid = 0; } static void upload_pack_data_clear(struct upload_pack_data *data) @@ -1178,6 +1180,11 @@ static void format_symref_info(struct strbuf *buf, struct string_list *symref) strbuf_addf(buf, " symref=%s:%s", item->string, (char *)item->util); } +static void format_trace2_info(struct strbuf *buf, struct upload_pack_data *d) { + if (d->advertise_trace2_sid && trace2_is_enabled()) + strbuf_addf(buf, " trace2-sid=%s", trace2_session_id()); +} + static int send_ref(const char *refname, const struct object_id *oid, int flag, void *cb_data) { @@ -1193,9 +1200,11 @@ static int send_ref(const char *refname, const struct object_id *oid, if (capabilities) { struct strbuf symref_info = STRBUF_INIT; + struct strbuf trace2_info = STRBUF_INIT; format_symref_info(&symref_info, &data->symref); - packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s object-format=%s agent=%s\n", + format_trace2_info(&trace2_info, data); + packet_write_fmt(1, "%s %s%c%s%s%s%s%s%s%s object-format=%s agent=%s\n", oid_to_hex(oid), refname_nons, 0, capabilities, (data->allow_uor & ALLOW_TIP_SHA1) ? @@ -1205,9 +1214,11 @@ static int send_ref(const char *refname, const struct object_id *oid, data->stateless_rpc ? " no-done" : "", symref_info.buf, data->allow_filter ? " filter" : "", + trace2_info.buf, the_hash_algo->name, git_user_agent_sanitized()); strbuf_release(&symref_info); + strbuf_release(&trace2_info); } else { packet_write_fmt(1, "%s %s\n", oid_to_hex(oid), refname_nons); } @@ -1299,6 +1310,8 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data) data->allow_sideband_all = git_config_bool(var, value); } else if (!strcmp("core.precomposeunicode", var)) { precomposed_unicode = git_config_bool(var, value); + } else if (!strcmp("trace2.advertisesid", var)) { + data->advertise_trace2_sid = git_config_bool(var, value); } if (current_config_scope() != CONFIG_SCOPE_LOCAL && From patchwork Mon Nov 2 22:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875457 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 CCD49C2D0A3 for ; Mon, 2 Nov 2020 22:31:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DE7122280 for ; Mon, 2 Nov 2020 22:31:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UoCnKZCX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726716AbgKBWbX (ORCPT ); Mon, 2 Nov 2020 17:31:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWbW (ORCPT ); Mon, 2 Nov 2020 17:31:22 -0500 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 499A0C0617A6 for ; Mon, 2 Nov 2020 14:31:22 -0800 (PST) Received: by mail-qv1-xf49.google.com with SMTP id z9so9203514qvo.20 for ; Mon, 02 Nov 2020 14:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=8EmPdbNGLatWhx+M1mauicW758Nhpdi0kjChavoMEKk=; b=UoCnKZCXpPOLgITobEbYZD8NkySsCwhb/HBcC/SHfcUEIH1pdKn3m2UzC7uzhuiGNc 72LMBdcBXH0mTjPtFrAe98MO2nL41yTgHHYZzhrJcEPF32KC8wKkPTgNQNPpfg5Wj8Ac JkDmKzkIrnmuAE40MJoZqTC5I+dLbtrbXWV8Mb0WXOMJcf/hqvq3MVjO6TYnwhSZJRaT GvMJybbqTsSQ6boY/Ff+6CRxuP8MFTdsWfbubvwA/x/K+0MIMBZdb56PwJ2DS2Ek+ljF NqI6F7LnuDqonrHVuyHal/E7LW8tUsVBXE3QiQh22EE96FPMdRQWXz3dc+Tt/STLDrN7 7qcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=8EmPdbNGLatWhx+M1mauicW758Nhpdi0kjChavoMEKk=; b=EKX5vke9fJELICdCISgwwBk+f4RmL+ItuqX+7icBLi3KzTqO1Pz5wVFWvQbEJmAhCI b+qUlw26/rHSg8uF284pccB7OKsgP2g+omrTQy2NEf+EZWl0dYYWEcPsU8FTQFrK9mk3 +L2toTrGCfSShvWKRySw8aBV6izKYhN7un+HJ5dNMVYwcx5lAz8BqfFnxdpiNcjTjTn/ fikh16Bli9pFHdzQLr5mDtXXpt/swOr8ExJQtxU4XcujBUMYV57U6SMaU30jXlUgMnuD U7Is158ciSJ47xK3WnX/lmKeZLFaGx963oZ8oAswhFbNYjy0snnFM17LUNDq1kJwAahc OKRw== X-Gm-Message-State: AOAM5332XOXw1YEBhehPYd8zyK3y4yYzPd27wlSOwEXTLoTZwPPvYpUG 2Y70y+9fWDfdHPlZlCh/km1IQuhSuC9AAHtcsMoEgJ0jH+1s2ucTyKUWcfN/QKZLoCva1mbJJue jsCvgEq6JCHrvgQ3vbRgb91umphzE7Myp/vzVILMyEe3CHkAAvisoiWD5bWB838Y= X-Google-Smtp-Source: ABdhPJyKr0Qf6Z26hpu65jVALYn9lMsQZwJJmLonX57dmylkpBwMPhB71/+6VPDDmjgdN8buuyLF7iuOOgxI0Q== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a05:6214:18cf:: with SMTP id cy15mr24918021qvb.53.1604356281376; Mon, 02 Nov 2020 14:31:21 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:03 -0800 In-Reply-To: Message-Id: <7003189c81b7642922eb73bac9b2a688c014a8bb.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 05/11] receive-pack: advertise trace2 SID in v0 capabilities From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled and trace2.advertiseSID is true, advertise receive-pack's trace2 session ID via the new trace2-sid capability. Signed-off-by: Josh Steadmon --- builtin/receive-pack.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index bb9909c52e..2fe5a8b4fd 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -54,6 +54,7 @@ static int receive_unpack_limit = -1; static int transfer_unpack_limit = -1; static int advertise_atomic_push = 1; static int advertise_push_options; +static int advertise_trace2_sid; static int unpack_limit = 100; static off_t max_input_size; static int report_status; @@ -248,6 +249,11 @@ static int receive_pack_config(const char *var, const char *value, void *cb) return 0; } + if (strcmp(var, "trace2.advertisesid") == 0) { + advertise_trace2_sid = git_config_bool(var, value); + return 0; + } + return git_default_config(var, value, cb); } @@ -268,6 +274,8 @@ static void show_ref(const char *path, const struct object_id *oid) strbuf_addf(&cap, " push-cert=%s", push_cert_nonce); if (advertise_push_options) strbuf_addstr(&cap, " push-options"); + if (advertise_trace2_sid && trace2_is_enabled()) + strbuf_addf(&cap, " trace2-sid=%s", trace2_session_id()); strbuf_addf(&cap, " object-format=%s", the_hash_algo->name); strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized()); packet_write_fmt(1, "%s %s%c%s\n", From patchwork Mon Nov 2 22:31:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875463 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 56E2FC2D0A3 for ; Mon, 2 Nov 2020 22:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EF6E22280 for ; Mon, 2 Nov 2020 22:31:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uTvgDdW8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbgKBWbZ (ORCPT ); Mon, 2 Nov 2020 17:31:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWbY (ORCPT ); Mon, 2 Nov 2020 17:31:24 -0500 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18956C0617A6 for ; Mon, 2 Nov 2020 14:31:24 -0800 (PST) Received: by mail-qt1-x849.google.com with SMTP id i39so9011255qtb.1 for ; Mon, 02 Nov 2020 14:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=p4L4TRUHpEhevASEZmzr0U4+YvhUsrFw7BKWbkCN5zs=; b=uTvgDdW8mF9wqj8/EwDG1XydXBbCmvqBRuSkYfGYtE1nV/zdEe4QQqccPWjMenD6V+ XhXDogG68X7T6Ktwfji5AzCdi6oyDA15AXBgjeHbWNNlYlxvaHvE56J10jqjLV05kCbW 31tjWGRwN2cIqT+5b47fiNSogumm5dm8mhfhF4978uoEjMnX6DYBxdvtHtCVXMjDCm3h KccJ7k/EenMYaACF4XPEVX3cy/W8VX2u4fbypWwEB1KszZYqkCMUsIhOWL7sw4B15aVl J/vmHJZv6MIVzhpHuwUIyLrjd4/Nr1qlD4Wj8CGAU9xF8bd2O7FlUmpLt7p4Jmd44k5e 3G2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=p4L4TRUHpEhevASEZmzr0U4+YvhUsrFw7BKWbkCN5zs=; b=HBYT7UUz3R1tsXGWQ+cTzmBZAkZPmuQOz6JNND1sMbcxCBVnUgYVEtaKxUwHTSxAou 7XYMc7l9LS4UY2tGGDWoWzaVjaLEY9ut9ARSvKp5cdmitQhpWRMkVqW6KbKtjywt2PVa ciC1QaqXEkA8QJM4dDhJ9uI5Ztx+TbgV2EF/VwtoJEs7L4Zb4cdMP7nezC6dG3OwqLNg py/UuHIFaVOizP88oshWNLXGFL5x0wWcbQH66afoZnw33u3iCrI0+jWk6tdZA+7PUIsG 5MBQ6rVNExfUUJZI7PBS6AwIllIRWv7eOE5Kkg9OfEez/pIJ7DL8LuKDV3XI7jK7mLw4 zT8w== X-Gm-Message-State: AOAM530E9F6BUGnR/u30J9SeA29CjMC88y9vooPnPcRas5FM0oLmEXbb Nl6hkQ8fIoXwNOfCOvO1Ra5ozkSQ6Pz/ujJT98tHI+q+4sAwth7E4koWiI7XUtKEY895csRxqUj BoZxJXSYT+3x8xn1gUr6Mz1C5Zy6eMd6Qb3i2G6CNNfKewan0LYzflP/plGXSVc0= X-Google-Smtp-Source: ABdhPJycZrPgNq3J7JTYgqScT5o1AovukvH75TvX3H09vGuTl7miuSh3Qo3g+mtoDPfKatiOCy+MkZAHqSEkNQ== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:ad4:458d:: with SMTP id x13mr25224947qvu.4.1604356283140; Mon, 02 Nov 2020 14:31:23 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:04 -0800 In-Reply-To: Message-Id: <9573428cc02111d3141ec2481bf679b31a5139e2.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 06/11] serve: advertise trace2 SID in v2 capabilities From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled and trace2.advertiseSID is true, advertise the server's trace2 session ID for all protocol v2 connections via the new trace2-sid capability. Signed-off-by: Josh Steadmon --- serve.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/serve.c b/serve.c index f6341206c4..b40d7aad34 100644 --- a/serve.c +++ b/serve.c @@ -8,6 +8,8 @@ #include "serve.h" #include "upload-pack.h" +static int advertise_trace2_sid; + static int always_advertise(struct repository *r, struct strbuf *value) { @@ -30,6 +32,15 @@ static int object_format_advertise(struct repository *r, return 1; } +static int trace2_advertise(struct repository *r, struct strbuf *value) +{ + if (!advertise_trace2_sid || !trace2_is_enabled()) + return 0; + if (value) + strbuf_addstr(value, trace2_session_id()); + return 1; +} + struct protocol_capability { /* * The name of the capability. The server uses this name when @@ -66,6 +77,7 @@ static struct protocol_capability capabilities[] = { { "fetch", upload_pack_advertise, upload_pack_v2 }, { "server-option", always_advertise, NULL }, { "object-format", object_format_advertise, NULL }, + { "trace2-sid", trace2_advertise, NULL }, }; static void advertise_capabilities(void) @@ -261,6 +273,8 @@ static int process_request(void) /* Main serve loop for protocol version 2 */ void serve(struct serve_options *options) { + git_config_get_bool("trace2.advertisesid", &advertise_trace2_sid); + if (options->advertise_capabilities || !options->stateless_rpc) { /* serve by default supports v2 */ packet_write_fmt(1, "version 2\n"); From patchwork Mon Nov 2 22:31:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875461 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 4400EC388F9 for ; Mon, 2 Nov 2020 22:31:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2CFA22280 for ; Mon, 2 Nov 2020 22:31:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ufE8ThDG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726784AbgKBWb1 (ORCPT ); Mon, 2 Nov 2020 17:31:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWbZ (ORCPT ); Mon, 2 Nov 2020 17:31:25 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF7EEC0617A6 for ; Mon, 2 Nov 2020 14:31:25 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id o129so6922000yba.12 for ; Mon, 02 Nov 2020 14:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=BNVRd5T93it6JWEErW0CeCqhga9rTnheZQpf84NSHvg=; b=ufE8ThDGG7+n5/BuQd5LFAQf8lCKzz/it1nB/kU94+pMLB3IZEgtZRFm+s73mUwnpH 3E1hWH0DZFrRGj7R5WYNzmt+i8TCdnlWaj6/YPGeweo2MGYgQeReREgpabNqs0BHjcHC Cogfst/S65MTJZwROZWv444nU6n6E1camO51HwzEdeVimphugQ4tAOKscPGAq/wyvgDi CxqHFeL4RioJbl3OuIgdZIZBV7U9K8l1uZlHYrp9AJ4OpdRV3DVxcL3lv70+3JkXIIBR pXoxbFazX+zFLtXXDyPEPNpmAwx32MDz2qI8lBBWBKhfR/H0QGEH6fqm21SHFGEIeSP2 4uiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=BNVRd5T93it6JWEErW0CeCqhga9rTnheZQpf84NSHvg=; b=RYJ64rUCbKQCvP8rH5hcqyd+ns2Gdqb+cUFwSr0WzvzhzE+EkGMyuPz18MOyW+lyJe eHaz+ptvER/uWs62LIf9acANv6VAWRwNKOjyft5n86gdLIYI6UMAzctBershhYzXKR1L ddJG9UnRvWqRFHQuwDkLup2p4UQy1wY4Iy+Co1tICw5Ig8DlrBOvxA/pBOAZFl6MR1po CM7LV1yTsAAyXJx2oDcdntxYCvY7jU8wPJFolFSJ8bW+/BgVVUULZo4rj+unUfrdK/sJ 1Vx7OD8wnR7wb1hrNWJw8OltlH1vTa4gpy3eWzj6mELXu4BQvEue8gMB1EbH1wQs8bnf i2NA== X-Gm-Message-State: AOAM530ZqBmPSB72YXXx3zhsvXZKrKMan5NeBLP0cNTaERmZIZEWuEl7 Y5Ry98G+exMJyTobJM9ycM1yNJ3SMt38PicIMfDV11zBvJaB7WUIVCSr0xsfHhayEB218wayzdx l0trkT+wT0eI2k/4qmE3+xvIj0D4T2t5S6RN1y/ahFQoJWNOFmaWSjd0uMal4G9o= X-Google-Smtp-Source: ABdhPJwtYQp6Z1ViOfjetcubMVYH8DpAKGmmwN/apkpYwKeNAJpHMMgK7RItc/9DGbFkqjGRfsrAbPSJbkUPWg== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a25:d7c4:: with SMTP id o187mr23835172ybg.363.1604356284966; Mon, 02 Nov 2020 14:31:24 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:05 -0800 In-Reply-To: Message-Id: <21bdbf23f39c800b1722c54b666df7a91b5879b5.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 07/11] transport: log received server trace2 SID From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When a client receives a trace2-sid capability from a protocol v0, v1, or v2 server, log the received session ID via a trace2 data event. Signed-off-by: Josh Steadmon --- t/t5705-trace2-sid-in-capabilities.sh | 64 +++++++++++++++++++++++++++ transport.c | 10 +++++ 2 files changed, 74 insertions(+) create mode 100755 t/t5705-trace2-sid-in-capabilities.sh diff --git a/t/t5705-trace2-sid-in-capabilities.sh b/t/t5705-trace2-sid-in-capabilities.sh new file mode 100755 index 0000000000..0870e78f7c --- /dev/null +++ b/t/t5705-trace2-sid-in-capabilities.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +test_description='trace2 SID in capabilities' + +. ./test-lib.sh + +REPO="$(pwd)/repo" +LOCAL_PRISTINE="$(pwd)/local_pristine" + +test_expect_success 'setup repos for trace2 SID capability tests' ' + git init "$REPO" && + test_commit -C "$REPO" a && + git clone "file://$REPO" "$LOCAL_PRISTINE" && + test_commit -C "$REPO" b +' + +for PROTO in 0 1 2 +do + test_expect_success "trace2 session IDs not advertised by default (fetch v${PROTO})" ' + test_when_finished "rm -rf local tr2-client-events" && + cp -r "$LOCAL_PRISTINE" local && + GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ + git -c protocol.version=$PROTO -C local fetch origin && + test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" + ' + + test_expect_success "trace2 session IDs not advertised by default (push v${PROTO})" ' + test_when_finished "rm -rf local tr2-client-events" && + cp -r "$LOCAL_PRISTINE" local && + git -C local pull --no-rebase origin && + GIT_TRACE2_EVENT_NESTING=5 \ + GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ + git -c protocol.version=$PROTO -C local push origin && + test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" + ' +done + +test_expect_success 'enable SID advertisement' ' + git -C "$REPO" config trace2.advertiseSID true && + git -C "$LOCAL_PRISTINE" config trace2.advertiseSID true +' + +for PROTO in 0 1 2 +do + test_expect_success "trace2 session IDs advertised (fetch v${PROTO})" ' + test_when_finished "rm -rf local tr2-client-events" && + cp -r "$LOCAL_PRISTINE" local && + GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ + git -c protocol.version=$PROTO -C local fetch origin && + grep \"key\":\"server-sid\" tr2-client-events + ' + + test_expect_success "trace2 session IDs advertised (push v${PROTO})" ' + test_when_finished "rm -rf local tr2-client-events" && + cp -r "$LOCAL_PRISTINE" local && + git -C local pull --no-rebase origin && + GIT_TRACE2_EVENT_NESTING=5 \ + GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ + git -c protocol.version=$PROTO -C local push origin && + grep \"key\":\"server-sid\" tr2-client-events + ' +done + +test_done diff --git a/transport.c b/transport.c index 47da955e4f..d16be597bd 100644 --- a/transport.c +++ b/transport.c @@ -286,6 +286,8 @@ static struct ref *handshake(struct transport *transport, int for_push, struct git_transport_data *data = transport->data; struct ref *refs = NULL; struct packet_reader reader; + int sid_len; + const char *server_trace2_sid; connect_setup(transport, for_push); @@ -297,6 +299,8 @@ static struct ref *handshake(struct transport *transport, int for_push, data->version = discover_version(&reader); switch (data->version) { case protocol_v2: + if (server_feature_v2("trace2-sid", &server_trace2_sid)) + trace2_data_string("trace2", NULL, "server-sid", server_trace2_sid); if (must_list_refs) get_remote_refs(data->fd[1], &reader, &refs, for_push, ref_prefixes, @@ -310,6 +314,12 @@ static struct ref *handshake(struct transport *transport, int for_push, for_push ? REF_NORMAL : 0, &data->extra_have, &data->shallow); + server_trace2_sid = server_feature_value("trace2-sid", &sid_len); + if (server_trace2_sid) { + char *server_sid = xstrndup(server_trace2_sid, sid_len); + trace2_data_string("trace2", NULL, "server-sid", server_sid); + free(server_sid); + } break; case protocol_unknown_version: BUG("unknown protocol version"); From patchwork Mon Nov 2 22:31:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875465 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 70277C00A89 for ; Mon, 2 Nov 2020 22:31:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D24722280 for ; Mon, 2 Nov 2020 22:31:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JirHhxOs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726820AbgKBWb3 (ORCPT ); Mon, 2 Nov 2020 17:31:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWb2 (ORCPT ); Mon, 2 Nov 2020 17:31:28 -0500 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613F7C0617A6 for ; Mon, 2 Nov 2020 14:31:27 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id t195so22074pfc.1 for ; Mon, 02 Nov 2020 14:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=9M8WtY0YgSD4L4mm5bxqFaLbq4HZfD92RxkJHLBNgDo=; b=JirHhxOsxkLct53r/cy6R8Bs+k0HhUa+4khA2grQVqoXHqEc6YCcmtayhwQ8Z0Rwo6 mqlwOkARqyY0isUjLUpgYrdxiWElVTyF8NoWqgJw35DuByc39D6TbJdOYXQO/2a5GF9b 93/ZOFczFUb722RfddNDI6dNn5CnozI6J5rqJZ16VTjUA8sAlcchdMmfbuwNjbrt8F9l RIjPJRbEI/tndDn+FYJjtQ44MwWU1dUFQOpCSisjtrJkXMqQb39Ewm+pO8VX2qth7H/R jHYymA2MkheIe4ItejVzGLDGRGs5Lq35TnNhcj+Mbdgmf3EhOKbd1g2D5itVsaN5ALBm 6DNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=9M8WtY0YgSD4L4mm5bxqFaLbq4HZfD92RxkJHLBNgDo=; b=X1nwok9phIgd1L3jIRNnS4fQBHOrnMgsafn1IvbXN/AF+VqGXSypHYfM8oHKUuOAEm z4wIWHcVNq5AtTRDVcO3/4iPmo6s1/+Icf+o9F8wUl+MPmmrKXt4tq3f9hhl/JlKHaKQ Rq4Pk015/aidOJoyP/7uZtnH0nLGKrEsaUvmhzev7vY5Z3miWgRWnzB90b6+e7XEiKVy 9f+ED7OhvW6x1Kfxcv/W/DxcLBPj+uXo5R/fev53ow8xThN6FWWqqE4XcEPUI3TR0/T4 sV8KXj8+S+Zo2GYENAANkO/Zm3jxGanW/cuoKujFxpvHEVtZirZS0UUPtCilwfd6Ibc4 6WPw== X-Gm-Message-State: AOAM532F6W6gyGgWe9C9K0Dj4RQvB6kivRepmZ+B2Tm7LKu6oH4Ga31y 193F2g1Xi7HlOLW9tkJhc2w11ROFgNndFcMOLk5qpHOLU9PUFkBL8nX/mmZcYWEYAGIjGnp17UH HLDhZwW+Z+Zh/J4MWgEWHJY8svS5M+2/YkKE9uzX2C5+rzLvniK5ErRTJaCO+FJo= X-Google-Smtp-Source: ABdhPJwtGcGm8xbuCDtqkSNr66fM3m4Ipd8RAPKhVcR/DnpNojKo1WjZUe+LcN8GzuMtfv6XnJEFPWPPq4CLkw== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a05:6a00:856:b029:18a:b222:403b with SMTP id q22-20020a056a000856b029018ab222403bmr12178268pfk.46.1604356286776; Mon, 02 Nov 2020 14:31:26 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:06 -0800 In-Reply-To: Message-Id: <11b5b1b54f14354f08c9eb230d5b4e6a3de1996b.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 08/11] fetch-pack: advertise trace2 SID in capabilities From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled, the server sent a trace2-sid capability, and trace2.advertiseSID is true, advertise fetch-pack's own session ID back to the server. Signed-off-by: Josh Steadmon --- fetch-pack.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fetch-pack.c b/fetch-pack.c index b10c432315..7fbefa7b8e 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -35,6 +35,8 @@ static int fetch_fsck_objects = -1; static int transfer_fsck_objects = -1; static int agent_supported; static int server_supports_filtering; +static int server_sent_trace2_sid; +static int advertise_trace2_sid; static struct shallow_lock shallow_lock; static const char *alternate_shallow_file; static struct strbuf fsck_msg_types = STRBUF_INIT; @@ -326,6 +328,8 @@ static int find_common(struct fetch_negotiator *negotiator, if (deepen_not_ok) strbuf_addstr(&c, " deepen-not"); if (agent_supported) strbuf_addf(&c, " agent=%s", git_user_agent_sanitized()); + if (advertise_trace2_sid && server_sent_trace2_sid && trace2_is_enabled()) + strbuf_addf(&c, " trace2-sid=%s", trace2_session_id()); if (args->filter_options.choice) strbuf_addstr(&c, " filter"); packet_buf_write(&req_buf, "want %s%s\n", remote_hex, c.buf); @@ -979,6 +983,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, agent_len, agent_feature); } + if (server_supports("trace2-sid")) + server_sent_trace2_sid = 1; + if (server_supports("shallow")) print_verbose(args, _("Server supports %s"), "shallow"); else if (args->depth > 0 || is_repository_shallow(r)) @@ -1191,6 +1198,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out, packet_buf_write(&req_buf, "command=fetch"); if (server_supports_v2("agent", 0)) packet_buf_write(&req_buf, "agent=%s", git_user_agent_sanitized()); + if (advertise_trace2_sid && server_supports_v2("trace2-sid", 0) && trace2_is_enabled()) + packet_buf_write(&req_buf, "trace2-sid=%s", trace2_session_id()); if (args->server_options && args->server_options->nr && server_supports_v2("server-option", 1)) { int i; @@ -1711,6 +1720,7 @@ static void fetch_pack_config(void) git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta); git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects); git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects); + git_config_get_bool("trace2.advertisesid", &advertise_trace2_sid); if (!uri_protocols.nr) { char *str; From patchwork Mon Nov 2 22:31:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875471 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 E6C56C00A89 for ; Mon, 2 Nov 2020 22:31:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A092F22280 for ; Mon, 2 Nov 2020 22:31:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fQvqxD3C" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbgKBWbb (ORCPT ); Mon, 2 Nov 2020 17:31:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWba (ORCPT ); Mon, 2 Nov 2020 17:31:30 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B87CC0617A6 for ; Mon, 2 Nov 2020 14:31:29 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id bc2so9379001plb.23 for ; Mon, 02 Nov 2020 14:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=2hJQ5+0X4beS66Jh7pYrdI0xmglyNQJJK/K5drFP/EY=; b=fQvqxD3CLQNhyfrsk1YJ7bf2J8SPI0fAnht3MfsQTD/EAf60E7zzjErjKnIMDKRB4R 2juzw/xWmrwJX+mltglGDIkSVdA1S4Y1kJsnAYFe/c34yB6MYq9vVzXEa2ZyXFs/lvbo 524WdFcMkcdZceyOfqrnsLNwY1S4T6Vrydoh/S7XFzjcv6q7lNnCsmmyba386j2PMnz/ oFH+AHrsPPuHChKJzd1Ca3tMB8lBv34LcX4W//hf3Ccv5BU94vy2KMe9jXxDbdaPfI0N x4z1jn/HVTo8TGo3DFCs5heTDNbT6CiAVNfv6FykPxqvITS3g8Ug7vwehqAgLQikxiAl jFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=2hJQ5+0X4beS66Jh7pYrdI0xmglyNQJJK/K5drFP/EY=; b=gMtUzA9gjfKIUmHnr99MG72oJc0JPP7tA8PsKnezCiT2sbYY/siY7HXFX+EstGCyJg vWGytYVeCruIgkLW943uTjfBAa5Oe8Rmopt0Ld73Hg3mtayeahsu3zpGNmF66rtzZalx CIAuoxbO0jxaQdIPg9WCPnFOWRk11xM++PWAve2ll4dzaxJt4x1mX3+k4UCZMprRLi4J nya+pQUx5sHs9p5gEKNvk9KqpQv4nCzRq9YjvnaAPlsKWZ9u9JLfLiSKuBewUiZlgWoq rv3cT9WjTYuHDFIxaUfK8Tz//FhaKlIyrHE9OTyvzIKzvMoXKhCyRjvLiXFyihaVo760 Ekjg== X-Gm-Message-State: AOAM53194Zb9sizLXv6PmNGLg0OFmsKjKmsZt/w1/TZiPIamOm1YEJlx 8Un3w6zIQueGwnf9MWvy99XYGVoOy5vNVDUMW297DmWdS3SfWIsxrQMdVh4YqZAkwHm8JVDchaA s7YhrrDFlNZYPIgcypTKx7IUhdi+OZHHOGfpSQRBuYRpXAh/6R3I2IyhjiClaDcc= X-Google-Smtp-Source: ABdhPJxgNzz7DpSvrtFi2T82Lftb9MKRT7RE4KWboX0HPPs64DsQAk0ULsjRZyh2NzKC8/W1rmYqe27+GduY5A== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a17:90b:4c43:: with SMTP id np3mr409976pjb.28.1604356288777; Mon, 02 Nov 2020 14:31:28 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:07 -0800 In-Reply-To: Message-Id: <23f44bc904dfdd31f68a27c587b4b61df4bc0041.1604355792.git.steadmon@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 09/11] upload-pack, serve: log received client trace2 SID From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When upload-pack (protocol v0/v1) or a protocol v2 server receives a trace2-sid capability from a client, log the received session ID via a trace2 data event. Signed-off-by: Josh Steadmon --- serve.c | 4 ++++ t/t5705-trace2-sid-in-capabilities.sh | 19 +++++++++++++------ upload-pack.c | 7 +++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/serve.c b/serve.c index b40d7aad34..ffe5ba3f8a 100644 --- a/serve.c +++ b/serve.c @@ -201,6 +201,7 @@ static int process_request(void) struct packet_reader reader; struct strvec keys = STRVEC_INIT; struct protocol_capability *command = NULL; + const char *client_sid; packet_reader_init(&reader, 0, NULL, 0, PACKET_READ_CHOMP_NEWLINE | @@ -264,6 +265,9 @@ static int process_request(void) check_algorithm(the_repository, &keys); + if (has_capability(&keys, "trace2-sid", &client_sid)) + trace2_data_string("trace2", NULL, "client-sid", client_sid); + command->command(the_repository, &keys, &reader); strvec_clear(&keys); diff --git a/t/t5705-trace2-sid-in-capabilities.sh b/t/t5705-trace2-sid-in-capabilities.sh index 0870e78f7c..3fad9462d3 100755 --- a/t/t5705-trace2-sid-in-capabilities.sh +++ b/t/t5705-trace2-sid-in-capabilities.sh @@ -17,11 +17,14 @@ test_expect_success 'setup repos for trace2 SID capability tests' ' for PROTO in 0 1 2 do test_expect_success "trace2 session IDs not advertised by default (fetch v${PROTO})" ' - test_when_finished "rm -rf local tr2-client-events" && + test_when_finished "rm -rf local tr2-client-events tr2-server-events" && cp -r "$LOCAL_PRISTINE" local && GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ - git -c protocol.version=$PROTO -C local fetch origin && - test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" + git -c protocol.version=$PROTO -C local fetch \ + --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \ + origin && + test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" && + test -z "$(grep \"key\":\"client-sid\" tr2-server-events)" ' test_expect_success "trace2 session IDs not advertised by default (push v${PROTO})" ' @@ -43,11 +46,15 @@ test_expect_success 'enable SID advertisement' ' for PROTO in 0 1 2 do test_expect_success "trace2 session IDs advertised (fetch v${PROTO})" ' - test_when_finished "rm -rf local tr2-client-events" && + test_when_finished "rm -rf local tr2-client-events tr2-server-events" && cp -r "$LOCAL_PRISTINE" local && + git -C local config trace2.advertiseSID true && GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ - git -c protocol.version=$PROTO -C local fetch origin && - grep \"key\":\"server-sid\" tr2-client-events + git -c protocol.version=$PROTO -C local fetch \ + --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \ + origin && + grep \"key\":\"server-sid\" tr2-client-events && + grep \"key\":\"client-sid\" tr2-server-events ' test_expect_success "trace2 session IDs advertised (push v${PROTO})" ' diff --git a/upload-pack.c b/upload-pack.c index 3bb01c5427..d938603c97 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1058,6 +1058,7 @@ static void receive_needs(struct upload_pack_data *data, const char *features; struct object_id oid_buf; const char *arg; + int feature_len; reset_timeout(data->timeout); if (packet_reader_read(reader) != PACKET_READ_NORMAL) @@ -1109,6 +1110,12 @@ static void receive_needs(struct upload_pack_data *data, if (data->allow_filter && parse_feature_request(features, "filter")) data->filter_capability_requested = 1; + if ((arg = parse_feature_value(features, "trace2-sid", &feature_len, NULL))) + { + char *client_sid = xstrndup(arg, feature_len); + trace2_data_string("trace2", NULL, "client-sid", client_sid); + free(client_sid); + } o = parse_object(the_repository, &oid_buf); if (!o) { From patchwork Mon Nov 2 22:31:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875475 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 0A197C2D0A3 for ; Mon, 2 Nov 2020 22:31:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C062A22275 for ; Mon, 2 Nov 2020 22:31:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="S/yHfgi/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbgKBWbd (ORCPT ); Mon, 2 Nov 2020 17:31:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgKBWbd (ORCPT ); Mon, 2 Nov 2020 17:31:33 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F8AC0617A6 for ; Mon, 2 Nov 2020 14:31:31 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id w4so15701302ybq.21 for ; Mon, 02 Nov 2020 14:31:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=3aNFn6yfjfb+gMRjfQE9R+KZYkxhYDxU8woVj/hNAsM=; b=S/yHfgi/vQdfK1BC025t8LKtRAtH4LxzR86Nz7pFHtAcVSZfP61DV6cQMkczUIcXHC VpUiWsDizbspaNmDw3KPLLtvcmoVzrWF66BACh5fKqpXgYmeCOUrfCV50c3YNnSPFx1Z gEhxtP11jSGxqY51RexjLw77czKJTp6HdPaLD9jfPohUot6ePe3FcDZaGdRiB+VXf919 +o/XMHUfGNgJKre0oJtGuozZnGrVqQmAa1WRKvbDHuMs7fj//TIdv3WZLlRDNYd+t46T pik/GHF6Z3lmwCSstjoxndD3dtLtX/3O4iKaboqnTIKZqc02oWaGGwgox2cjVxOfkPZF FHfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=3aNFn6yfjfb+gMRjfQE9R+KZYkxhYDxU8woVj/hNAsM=; b=cNaLEnolZQ9yUbhpALIpUcuVO1qAjwzIPNGycOExIFCv973l22lwPBTUqpmkuAMQzA Pqgpd5vXyTQesd1cuUFoRgZpH8GDN36pVj38jVAxdXt4d4/zxUfxYqmoLRppez2UstOB 6epESqBtQmi9Z0nX18Pua3KGwpP5NkY2j0miWYvvIGZltbX8RYJ1Ewco2oifTAmgGHzM TeOp3DkMfmuFXx5WXlpKp9au+uDdjnXE2+nJXEjVn/IKyQWJFeRW2QB1a9KS4DVaHOkC /H9YaEFjv8cqmEcgLzs+tSrW73w+5k8i4/+ScYzluuvL4RSWyACpq1Re1heOvYSMU3Cs 21+A== X-Gm-Message-State: AOAM533g0HXdM8XiTPJQmc6rHiGVEoYekex42xARPtlhhXiCNePpIkZp UgcVAatLuRZO/k770tJGA2o7DqLp1AeBGc5T2NMwjT58envNbKvoo4yCtaoo0YV/qWmskXbxeHM 9FAuX48r2CwzEl/LulJz9tK43qeHDrsBWf2fBfZ2SekV7b99axPVZK+HkTxhsFGY= X-Google-Smtp-Source: ABdhPJxpUBxw6kKq4+/MaK9yGgNb9RVKi5RCIRwr3exGLSIq9ArEntVy90RboCfQ8Zpn2WWRAhwPDVpcrXBk2A== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a25:aaa3:: with SMTP id t32mr21687401ybi.209.1604356290853; Mon, 02 Nov 2020 14:31:30 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:08 -0800 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 10/11] send-pack: advertise trace2 SID in capabilities From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled, the server sent a trace2-sid capability, and trace2.advertiseSID is true, advertise send-pack's own session ID back to the server. Signed-off-by: Josh Steadmon --- send-pack.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/send-pack.c b/send-pack.c index eb4a44270b..7478a3f7cc 100644 --- a/send-pack.c +++ b/send-pack.c @@ -424,6 +424,8 @@ int send_pack(struct send_pack_args *args, int use_sideband = 0; int quiet_supported = 0; int agent_supported = 0; + int server_sent_trace2_sid = 0; + int advertise_trace2_sid = 0; int use_atomic = 0; int atomic_supported = 0; int use_push_options = 0; @@ -435,6 +437,8 @@ int send_pack(struct send_pack_args *args, const char *push_cert_nonce = NULL; struct packet_reader reader; + git_config_get_bool("trace2.advertisesid", &advertise_trace2_sid); + /* Does the other end support the reporting? */ if (server_supports("report-status-v2")) status_report = 2; @@ -450,6 +454,8 @@ int send_pack(struct send_pack_args *args, quiet_supported = 1; if (server_supports("agent")) agent_supported = 1; + if (server_supports("trace2-sid")) + server_sent_trace2_sid = 1; if (server_supports("no-thin")) args->use_thin_pack = 0; if (server_supports("atomic")) @@ -506,6 +512,8 @@ int send_pack(struct send_pack_args *args, strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name); if (agent_supported) strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized()); + if (advertise_trace2_sid && server_sent_trace2_sid && trace2_is_enabled()) + strbuf_addf(&cap_buf, " trace2-sid=%s", trace2_session_id()); /* * NEEDSWORK: why does delete-refs have to be so specific to From patchwork Mon Nov 2 22:31:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 11875473 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 37B29C2D0A3 for ; Mon, 2 Nov 2020 22:31:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF31422280 for ; Mon, 2 Nov 2020 22:31:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IHnpAt5x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbgKBWbh (ORCPT ); Mon, 2 Nov 2020 17:31:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbgKBWbe (ORCPT ); Mon, 2 Nov 2020 17:31:34 -0500 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 639BEC061A47 for ; Mon, 2 Nov 2020 14:31:33 -0800 (PST) Received: by mail-pf1-x449.google.com with SMTP id x9so93854pff.10 for ; Mon, 02 Nov 2020 14:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=0quhPvqcttL64DwwfKTdxeJXoaOt/BR6lQ3hKOkcjDU=; b=IHnpAt5xmfgsfMyxlpJ62jDK3EHumhxF2M4sOOf2UAn20pKZbf/Rftfe+FScI8lBbJ 1FGip4KGDINbioJ1/9/cxO47v6KkMPS1bksH4MD/XpSZ9Mmp24G7ELap2Mr9GeJ3Qw1n mHqgVUPGDeNLu4fdx9wDdkGifF9ZOnmS41aJUE82nTP6uAni9zfNGpGV5S9gTaMhnPaq rePLY6seb4obqipo3hg3KMq7wfbUOKbQYzqSk3+rickXPS4WmGkakllAKbD56xfCkPmo U89I8xH6stvx7Pz7btT0nOdl9mjp6EEgtiuHy0pDPSbfnJoAW0JYmjUVWPCxzsqZD9TE 1Adg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=0quhPvqcttL64DwwfKTdxeJXoaOt/BR6lQ3hKOkcjDU=; b=UR8/M/lgYs/lmvfn+J4I3tiHFJl7gq0JZmQAKbatXEZUnkq76+Wr9Z6FRj+avolKVD IBvmpUAhDIkxkMWEQQx2MsdUR3C8nej6M4outnZgIUW+kQUKa1SlUq98/rVvnPDdgI6n nE0+PZmJNGDED3gW0dFG2q0T+lGJMPryUKqX23L2VLVDfU/qTJQsnUAtQANj73Ydtgcv 4eSYICjdrxNj567qrQr7P3OTxrooLs5uiJuRUqxb4qsjWkc/0DQ79/QuOufTsgSD+HGH Za3njhxCRQ00WJQTJkuzMEcgwkUSoRM6X/sZDtPd5YMq72WWI/g+yYy0SXl0yyfj9jGa iJFg== X-Gm-Message-State: AOAM533Ep4+zJuHcslpsySaUKMuQscszFy2thPsee3T0TWNU/ndtCrvh 3pV74Tv7nBvS+PlGllmrbBA9ERU0zFQHGrsa4hAqwLuqkSTZr6ItHhuHOogaISZQ/ueuwoH+Uel v770E8LbYGtRUWCjSBmQ6fOv+j7czQFJSVgreRGjl48xnamrHqMeAP8zfptyZw3I= X-Google-Smtp-Source: ABdhPJx6IZJ1BIGNjfr+B1pdbCBxM5F7mTwNFPDR2xpPAGbB9mgAswdfwvKswP+/LI/4mFGe6YxrX44Ke1PFLw== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a17:90a:5908:: with SMTP id k8mr381823pji.222.1604356292715; Mon, 02 Nov 2020 14:31:32 -0800 (PST) Date: Mon, 2 Nov 2020 14:31:09 -0800 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 11/11] receive-pack: log received client trace2 SID From: Josh Steadmon To: git@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When receive-pack receives a trace2-sid capability from the client, log the received session ID via a trace2 data event. Signed-off-by: Josh Steadmon --- builtin/receive-pack.c | 7 +++++++ t/t5705-trace2-sid-in-capabilities.sh | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 2fe5a8b4fd..f780a66a52 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2039,6 +2039,7 @@ static struct command *read_head_info(struct packet_reader *reader, if (linelen < reader->pktlen) { const char *feature_list = reader->line + linelen + 1; const char *hash = NULL; + const char *client_trace2_sid; int len = 0; if (parse_feature_request(feature_list, "report-status")) report_status = 1; @@ -2061,6 +2062,12 @@ static struct command *read_head_info(struct packet_reader *reader, } if (xstrncmpz(the_hash_algo->name, hash, len)) die("error: unsupported object format '%s'", hash); + client_trace2_sid = parse_feature_value(feature_list, "trace2-sid", &len, NULL); + if (client_trace2_sid) { + char *client_sid = xstrndup(client_trace2_sid, len); + trace2_data_string("trace2", NULL, "client-sid", client_sid); + free(client_sid); + } } if (!strcmp(reader->line, "push-cert")) { diff --git a/t/t5705-trace2-sid-in-capabilities.sh b/t/t5705-trace2-sid-in-capabilities.sh index 3fad9462d3..15f78cb7d2 100755 --- a/t/t5705-trace2-sid-in-capabilities.sh +++ b/t/t5705-trace2-sid-in-capabilities.sh @@ -28,13 +28,17 @@ do ' test_expect_success "trace2 session IDs not advertised by default (push v${PROTO})" ' - test_when_finished "rm -rf local tr2-client-events" && + test_when_finished "rm -rf local tr2-client-events tr2-server-events" && + test_when_finished "git -C local push --delete origin new-branch" && cp -r "$LOCAL_PRISTINE" local && git -C local pull --no-rebase origin && GIT_TRACE2_EVENT_NESTING=5 \ GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ - git -c protocol.version=$PROTO -C local push origin && - test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" + git -c protocol.version=$PROTO -C local push \ + --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \ + origin HEAD:new-branch && + test -z "$(grep \"key\":\"server-sid\" tr2-client-events)" && + test -z "$(grep \"key\":\"client-sid\" tr2-server-events)" ' done @@ -58,13 +62,17 @@ do ' test_expect_success "trace2 session IDs advertised (push v${PROTO})" ' - test_when_finished "rm -rf local tr2-client-events" && + test_when_finished "rm -rf local tr2-client-events tr2-server-events" && + test_when_finished "git -C local push --delete origin new-branch" && cp -r "$LOCAL_PRISTINE" local && git -C local pull --no-rebase origin && GIT_TRACE2_EVENT_NESTING=5 \ GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \ - git -c protocol.version=$PROTO -C local push origin && - grep \"key\":\"server-sid\" tr2-client-events + git -c protocol.version=$PROTO -C local push \ + --receive-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-receive-pack" \ + origin HEAD:new-branch && + grep \"key\":\"server-sid\" tr2-client-events && + grep \"key\":\"client-sid\" tr2-server-events ' done