Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1273408rdb; Wed, 24 Jan 2024 09:49:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtYzk+pUopQCDO3oHzPslCZYRdWeHwjH0Ok0/D/muxzLx57DvBOOhKS6aRcrycciJGagZ5 X-Received: by 2002:aa7:c2d8:0:b0:55c:4c26:52a8 with SMTP id m24-20020aa7c2d8000000b0055c4c2652a8mr1904399edp.44.1706118568727; Wed, 24 Jan 2024 09:49:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706118568; cv=pass; d=google.com; s=arc-20160816; b=lTUfFEyfyDcLNWPF5UXLLNYh+H/GiwiqtSyoSQO/CQMJhtAJiQksKyIhuxUYrr9Qc3 QZ8002pWYfBfkD4q4pJ8mCyraW4NZNKGdJdZ+a7rYC1DPVbd1sMCewBUDMG9P4N3sHwz mO5Ofg43b7ED990jMjbE5Obg258NWzFbpZ5K0USOvG/B6IFfNVedYr6d/MDpdvwbzqg1 MO9NU726jolg3MZe6XGttB257OBi0y6k6j5/CHhSYWBQYGjjRdkp4CgFEn0HlMakc3cU /niIjm2JEbAEoUvrx7D9PR5z3GKeVvg1rUjBAbFHAKiFbUypzXC/7uHMAHFupcBdB01a gmqg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; fh=3uQAHc0NqngPtrB5YLPjrfJArntTgtKXo4NRJp5QtWs=; b=LTdbwlEqNuD30B3mmdkYgNw300+JOP6o68TfndADwZo7Sv2tMZ0Qxd6E+3AEZ2jtRb hpPU0pZzL0kmsiSnGgiOZsoLqOEAsyvFBN05qXc3iG7h+Ltj/Hrz7HLwJh6jkZzoLTv7 c7xWEEJV9SSFgBtoA48A8GJQzPBzl9SYkyqMFXGdWy5V762xJcxOyFU1Vk15TwTV5kBU T5HwNFF86nmaGpOWT4dR9wnh3B/AnZSvdOQlI9tPEEBP8XjRxt89XOJrDmkFtcqzI43o +yjCv70hn0MIGzvlnm2FLcP8EWv3RTA2g2szzh1mpcTrUoxk7Y35kbH1uvXIzlavngrg D16w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ABzXQkTJ; 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-37459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g21-20020a056402091500b0055732ec79d2si14208418edz.158.2024.01.24.09.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:49:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ABzXQkTJ; 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-37459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37459-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2BC161F22520 for ; Wed, 24 Jan 2024 17:49:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1B1D12AAF9; Wed, 24 Jan 2024 17:47:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ABzXQkTJ" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 8EE2812A16B; Wed, 24 Jan 2024 17:47:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706118445; cv=none; b=uEKe7QJl4Z/wjlkaQljKWMxZZtlP94KqKOsB8yzej9OB/ZR5f3TeKR6fq60WIKinp3LX7TkpkgF8TeNZOjkKqdY+G+6QzQ3/y/tJ+mIgbg26E9m8CG5/HmY13Fqi/a5RxlBzSQXYiqd7vziKvjY5qZGgvZcpwyUaLTRRB9n1wik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706118445; c=relaxed/simple; bh=JUBz4HV56EeU4/nPAgND0SO1KSnQD6Dq6LeiFiNVnDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ia1PWMrhwcs8Lv8mDrX3j2PTLqQPPpw2ypuZsBa5tuMjIyi1r9xvjFt7vf2YGb1njdtdAJjJGCYUDKJ7G41Ya78dqH0VWpOq/+kyz0NHeGamTnFNltm4NGfWx17ytacLdgQAVqmbv5rVbJn/B4AVIeyNkELtWw/7SM4XpCqC5H0= 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=ABzXQkTJ; arc=none smtp.client-ip=209.85.214.176 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-pl1-f176.google.com with SMTP id d9443c01a7336-1d720c7fc04so33999175ad.2; Wed, 24 Jan 2024 09:47:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706118442; x=1706723242; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; b=ABzXQkTJh2DWgIeRs7Kca4RYpIiAmZOkEgIfajPbQk3opGCN0tmWIludURmhuiWcgp eQDY8ptddLqmC/Ba2PQ5x4zcavAop6EgGBPdvYHKFD0bUCCfY/FQ78Kumwpj+Le1v2Ms VKpAbJfUt52Febv+GgzgPonuZitNpaiP/tmi2vIfJSamEoD7CZDa/Jk7o/VdlZq5BRqS 2lwUV2j4RSNU1y4enZuRwLVsppWjwfS993o+7emd7AZ3r+YfZqO452hY4ut5W9kjNLWq jkvHbIZ/he9Lgy6BMgav3QIkAG6M/g7W+sRDdAN9DOCTkMlLgjlSaoEntuqXr6j0u6jP KjWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706118442; x=1706723242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; b=m1pQvVXuUBJTQA7LZM8Fp1vXF5AKfl4/XdBTXVzebanezxdBPPe9W6NDfZ+6/Xqief e46xU5cWWtgWuVFiNs9oO1pCaG88UZmarza/I5QLq+M9Qnk5vMk6tGHjvrxqSjoi2p0q iS0DQ3tyIo0WoL8+VeVFPwTqEyWmkx8eOoPVXbtK9qP9klMpw5OwVyPrVUrOA+kK+uxB px4ChpxrsvPHHu+3WTmBdaJ1hXQ+qtfVk8HRGyCrnKdGPu4Xd5HuQ7cv1HY59zvRIRY9 btRtndLfkzcbIuGfyO0HYy8ERbf1MjbWUttcgRjjFg8ZQJWJrB4jyqf0vnfvxOfJLBtf K9uw== X-Gm-Message-State: AOJu0YwIdDHk+fVeASmB3ZpAEKrqsJ1Q8TprH0DGmt7ZRyCSyGcdq7aw /n0KRTYbOqawRfwhabVXiv0Ff0GyZRugZq07cZmNrWxGUoaSMeab2mtn2W6C X-Received: by 2002:a17:903:41c2:b0:1d7:6c80:644f with SMTP id u2-20020a17090341c200b001d76c80644fmr1210450ple.9.1706118441767; Wed, 24 Jan 2024 09:47:21 -0800 (PST) Received: from localhost ([2601:644:9380:8cd0::7fb4]) by smtp.gmail.com with ESMTPSA id z22-20020a1709028f9600b001d6fbbdcb82sm10665544plo.134.2024.01.24.09.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:47:21 -0800 (PST) From: Matthew Wood To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet Cc: leitao@debian.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v1 4/8] net: netconsole: add docs for appending netconsole user data Date: Wed, 24 Jan 2024 09:47:02 -0800 Message-ID: <20240124174711.1906102-5-thepacketgeek@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124174711.1906102-1-thepacketgeek@gmail.com> References: <20240124174711.1906102-1-thepacketgeek@gmail.com> 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 new User Data section to the netconsole docs to describe the appending of user data capability (for netconsole dynamic configuration) with usage and netconsole output examples. Co-developed-by: Breno Leitao Signed-off-by: Breno Leitao Signed-off-by: Matthew Wood --- Documentation/networking/netconsole.rst | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Documentation/networking/netconsole.rst b/Documentation/networking/netconsole.rst index 390730a74332..54f072f47921 100644 --- a/Documentation/networking/netconsole.rst +++ b/Documentation/networking/netconsole.rst @@ -15,6 +15,8 @@ Extended console support by Tejun Heo , May 1 2015 Release prepend support by Breno Leitao , Jul 7 2023 +Userdata append support by Matthew Wood , Jan 22 2024 + Please send bug reports to Matt Mackall Satyam Sharma , and Cong Wang @@ -171,6 +173,72 @@ You can modify these targets in runtime by creating the following targets:: cat cmdline1/remote_ip 10.0.0.3 +Append User Data +================ + +Custom user data can be appended to the end of messages with netconsole +dynamic configuration enabled. User data entries can be modified without +changing the "enabled" attribute of a target. + +Directories (keys) under `userdata` are limited to 54 character length, and +data in `userdata//value` are limited to 200 bytes:: + + cd /sys/kernel/config/netconsole && mkdir cmdline0 + cd cmdline0 + mkdir userdata/foo + echo bar > userdata/foo/value + mkdir userdata/qux + echo baz > userdata/qux/value + +Messages will now include this additional user data:: + + echo "This is a message" > /dev/kmsg + +Sends:: + + 12,607,22085407756,-;This is a message + foo=bar + qux=baz + +Preview the userdata that will be appended with:: + + cd /sys/kernel/config/netconsole/cmdline0/userdata + for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done + +If a `userdata` entry is created but no data is written to the `value` file, +the entry will be omitted from netconsole messages:: + + cd /sys/kernel/config/netconsole && mkdir cmdline0 + cd cmdline0 + mkdir userdata/foo + echo bar > userdata/foo/value + mkdir userdata/qux + +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 + +Delete `userdata` entries with `rmdir`:: + + rmdir /sys/kernel/config/netconsole/cmdline0/userdata/qux + +Beware of `userdata` entries with newlines since values are printed with +newlines preserved. A userdatum value with a newline could cause the +netconsole message receiver to interpret a value as a new userdata key:: + + cat userdata/foo/value + bar + bar2 + +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 + bar2 + Extended console: ================= -- 2.43.0