Received: by 2002:a05:7208:13ca:b0:7f:395a:35b6 with SMTP id r10csp38080rbe; Wed, 28 Feb 2024 09:51:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXR2seB2Vz9FdeW/FIo2GSz3tFwur5Eul/Rt0d9AjPlJDqdg7M/ZFD0wGmVhahLdPgLaBAl16kQ81MoSYxxiecceAjblL9sEiabTiezLQ== X-Google-Smtp-Source: AGHT+IEfmj9DMjp18mE6r7SbUtYItFlABlsO98N+xteOcwXsuwJrNWb7yu/+QsCQ6djcBKU8jZJ/ X-Received: by 2002:a17:903:238e:b0:1da:22d9:e7fd with SMTP id v14-20020a170903238e00b001da22d9e7fdmr193229plh.20.1709142695289; Wed, 28 Feb 2024 09:51:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709142695; cv=pass; d=google.com; s=arc-20160816; b=RsV+sWDX9p3YrYLiE/U+p60PU4049CWQSvz05gZzgjZH39/TZI2u5F1SrEycKTKBsA 3Ab7aCNntmLHBhwh4kYWyyKUEE8CQJ7RHChMBQiICWQ9dTqsYdmCEFSRfPGxCwuqvOtm csO010pkFsuaN6x5S7MH3NxjC17rLMnHLJXxIvx4kVVYxiNHJbwjzaouMPrp7PV1qpJY RfED2TW2xHIMc7EWWxR8ig/dR6Bbzq+IqTiTjgrne7psBHGgX4iiEyvGkdnQT7XGTCdY ID16bqPjY2mcaOY84ElB++VJLnXuqaxBiAB5Wy5nBw6spoTsLnYE2eJy/4Hwfnsd43lB hk9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=8hdoeVf9X1lwZIz9iqQKc7IzOYBkljTE/nXMpcz9SPU=; fh=+7o4eRimKASWeoHpBQ4JLhoIr5S39E9f9VRa01QRjLI=; b=L9UM2M45aMyhkaH0juvFX47c11ZAoXE2ftygSHPPfft58oL3kaMaktLDVhjw2KWfgt Py/lPde5qMeb/iUi+VckAPIoveUgFha7Up31eAJ5t3M2drSj0vdp4GSI3RSlYmobcMjh dSRi3lzEaS0Yy5hHC+V2VfSLDlP68TfPJQwAHaxdOLWgHPKk1aIpqwiwio05APdjEGgb Auy68XrkMcSAgdH5Cm9blMVILDflbNc7ni+W55soubt/LUs74DDam9hb3uJI1TvkvddZ x0HXC27vFTLD0+lvsN5pKX1/AfSr0GZxoCp46epbIpx1nRDfO6toPJmPUJb6SI+YFL7j 51hQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KKQsQ62s; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-85440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h6-20020a170902eec600b001db7607a9f1si3618197plb.186.2024.02.28.09.51.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:51:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KKQsQ62s; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-85440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6E5E7B226AE for ; Wed, 28 Feb 2024 17:30:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB5CD15A480; Wed, 28 Feb 2024 17:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KKQsQ62s" Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A4803FBA2; Wed, 28 Feb 2024 17:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709141391; cv=none; b=W0COTqoZ4EuUKBCkhtxyfPXqrOCjDjcarpJamfwS+fyw/M7hB1i97FPMNhdMv/yRMRUZv0G7KlBZR9vZbsc3Yg4g+FTVBzVMU0Rh8lyr1n83ae4KfesxPsjKL0g+esa8Ehm8KIkzKeEK0yTJ242Zi8lgXUVPO+uKLZ6MW/6O+PM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709141391; c=relaxed/simple; bh=SeuTGsKnwySucOn6iEbScm1gy7cOEmGzvuZ8qUGTARk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RSTLczKxIRf7K0S/5cLh73XVdBl3LEx0bbX3VrXBx3Pz9BSZb5p9cfNOqTIwLvgfLsRimbeMt8nuPUx5FszCCYYgkE/d9u27CHOCqtaWhXiz+T4c8qvBFmE/JgkNitYgj0jnSkTARgzMh9b7hM2I1WGeW5U90fG+3cisNqPd6aw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KKQsQ62s; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3c19b7d9de7so2020659b6e.2; Wed, 28 Feb 2024 09:29:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709141389; x=1709746189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8hdoeVf9X1lwZIz9iqQKc7IzOYBkljTE/nXMpcz9SPU=; b=KKQsQ62sDSjxBA0+WQalnIq2x0j4NB19bJWWN1If9AZlsTo9SKapXZPqSLgErFS7Mo +tD46uAQPUAoc6y3uqQTB2Muxnz08BkSIcqXnt27cmfxgQWhXuB5I4HYoRgZrIYyhWWZ +YoXsagZomF04FfQnbvowq5x37tb5Y9aXQ1+PWiU/LhlpBxM/ZsKqhWWVglHzHGyTCRi ACTxgqpVWEwiB6q3hIQrLEWWmjf74q6raOd/BXWtKoyuw2VA2ZG+QxrLYBLYglRcJsy0 qdfrV7F7DT/1t0yyzFvLq7ghmc8uDk9leAQOyxsOXnhGQxJoe0ed+SMIU2c11Qc/dMca Mfdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709141389; x=1709746189; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8hdoeVf9X1lwZIz9iqQKc7IzOYBkljTE/nXMpcz9SPU=; b=g+0lWkKTh0v1dn7UIRpk6LQF9U9+EfDASBDEhM0GawbUL2svKMqJhuZkF8VGwE+SBn BiFYeViZBiXD6NpbTJPgIUsO7EaSBrquXuZ3MsA97R9+ckyBnRDEHgQC0CYPOmayg8w2 hSPhs1CpjUraaKcGn8kVWYa15U9us+wBsIhMcgC8rPCNQbSIWqIa+lAWEJazR0LCk7AJ wbsueYR+QBX7TPo2pPZ6/gKFN4j2FPb7DFI4yAdPj/GMdE9LLOLDU6IKP5Jx4uasPS8W Fmf2rENZz1cPKOhgR12iwTmo6v/PAyDO/oASRqV+JA/Zw5L/2Duz7S97ADYqgyhDTeHi WMXQ== X-Forwarded-Encrypted: i=1; AJvYcCV8fcekHGpGa7BaVTq2Scd0l0eY8zVS9+pIOkwJorP4IHq7XIsapP+Q4orrSy06a92nA1eNScQSIG7vMIBVUJ5RqvzwWyjn5yobn7wl4ehh+kpQPMwMSLwUS/raHabYiXUxGSiLWkvk X-Gm-Message-State: AOJu0YxayHBQqnoRGwW9KC9Muxckix7Uo5VzoRBOh1h8JKVj/9c6RJZT k7/ZvRirGh5wCTIrC2flFrK6qJbzgKPMaiM5EKgDpu2tKOQmHOTi X-Received: by 2002:a05:6808:1391:b0:3c1:adc8:7e3b with SMTP id c17-20020a056808139100b003c1adc87e3bmr6056478oiw.41.1709141389380; Wed, 28 Feb 2024 09:29:49 -0800 (PST) Received: from localhost ([2601:644:9381:2f20::2d05]) by smtp.gmail.com with ESMTPSA id i21-20020aa787d5000000b006e55d5215dbsm1825588pfo.87.2024.02.28.09.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:29:49 -0800 (PST) From: Matthew Wood To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Breno Leitao Cc: netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: netconsole: Add continuation line prefix to userdata messages Date: Wed, 28 Feb 2024 09:29:46 -0800 Message-ID: <20240228172948.221910-1-thepacketgeek@gmail.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a space (' ') prefix to every userdata line to match docs for dev-kmsg. To account for this extra character in each userdata entry, reduce userdata entry names (directory name) from 54 characters to 53. According to the dev-kmsg docs, a space is used for subsequent lines to mark them as continuation lines. > A line starting with ' ', is a continuation line, adding > key/value pairs to the log message, which provide the machine > readable context of the message, for reliable processing in > userspace. Testing for this patch:: cd /sys/kernel/config/netconsole && mkdir cmdline0 cd cmdline0 mkdir userdata/test && echo "hello" > userdata/test/value mkdir userdata/test2 && echo "hello2" > userdata/test2/value echo "message" > /dev/kmsg Outputs:: 6.8.0-rc5-virtme,12,493,231373579,-;message test=hello test2=hello2 And I confirmed all testing works as expected from the original patchset Fixes: df03f830d099 ("net: netconsole: cache userdata formatted string in netconsole_target") Signed-off-by: Matthew Wood --- Documentation/networking/netconsole.rst | 6 +++--- drivers/net/netconsole.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/netconsole.rst b/Documentation/networking/netconsole.rst index b28c525e5d1e..c2dec12f6060 100644 --- a/Documentation/networking/netconsole.rst +++ b/Documentation/networking/netconsole.rst @@ -197,8 +197,8 @@ Messages will now include this additional user data:: Sends:: 12,607,22085407756,-;This is a message - foo=bar - qux=baz + foo=bar + qux=baz Preview the userdata that will be appended with:: @@ -218,7 +218,7 @@ The `qux` key is omitted since it has no value:: echo "This is a message" > /dev/kmsg 12,607,22085407756,-;This is a message - foo=bar + foo=bar Delete `userdata` entries with `rmdir`:: diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 0de108a1c0c8..ffd3e19406b5 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -43,7 +43,7 @@ MODULE_DESCRIPTION("Console driver for network interfaces"); MODULE_LICENSE("GPL"); #define MAX_PARAM_LENGTH 256 -#define MAX_USERDATA_NAME_LENGTH 54 +#define MAX_USERDATA_NAME_LENGTH 53 /* 256 - 200 - 3 (for ' =\n' chars)*/ #define MAX_USERDATA_VALUE_LENGTH 200 #define MAX_USERDATA_ENTRY_LENGTH 256 #define MAX_USERDATA_ITEMS 16 @@ -671,7 +671,7 @@ static void update_userdata(struct netconsole_target *nt) * checked to not exceed MAX items with child_count above */ complete_idx += scnprintf(&nt->userdata_complete[complete_idx], - MAX_USERDATA_ENTRY_LENGTH, "%s=%s\n", + MAX_USERDATA_ENTRY_LENGTH, " %s=%s\n", item->ci_name, udm_item->value); } nt->userdata_length = strnlen(nt->userdata_complete, -- 2.43.2