From patchwork Thu Feb 22 13:42:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 204767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp258973dyb; Thu, 22 Feb 2024 05:44:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWv5bugzjQ0iXnan4MIgYsN0kDZFG3SrsE5ILXa/zV4CEgSKEzSY0sllvfRuANWrvHRZ9AhepiEA0Rql4ZQzsWeQhW6Pw== X-Google-Smtp-Source: AGHT+IG+qzIHjfjlQ7qfs0xkzZw4HVIZexdov/h4/bw2EcLv0R+08qYZ+YagK5ilKhX1rLIE4U1w X-Received: by 2002:a17:906:1358:b0:a3f:4b10:134 with SMTP id x24-20020a170906135800b00a3f4b100134mr2906050ejb.72.1708609441311; Thu, 22 Feb 2024 05:44:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708609441; cv=pass; d=google.com; s=arc-20160816; b=DXQxAywnLKXcSuWJJ2dIQSdxBCXHsu5xA+3iRWwwlOmTE3mSA8rGqnTnVz8N/Du0JY N20DW41Bh5Kwv0F9Q9DC+swgnLg9dPLZIRx4gdc8LvysYcKZEtwLYgRIk4XlGAEoyY67 u5fDFy4tNUrszSiVTFYzuZ0rkiNrUqKtCqOjaU8qEKmHFXi910Y7JZ1HotC2lJPdd1yY em6VZOr8UPu7Negz8gICPZsBNBdihYcECiyBumAL5D72gvmGNZna8xcNEIUkXIHVRYyn sESO8W0UTcxDFXc67CwRxbaHmhpp6jeMk2t0a1gZpL1MWC9lXc1Uy2CXSNBMLbLNCons c9pg== 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:dkim-filter; bh=ntM1lJl9v7kyuGzcxYVa7L1YvVosnIeM09eUzJVM3Ys=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=E1SvsmrTa40ITLkzO6AkgIaTq3H1cqSSzJ7p0Pt5gvFhminjeNId/eibdBBgn/6WT9 fWByf0XzqiI5qbmiFjgicxOzh9a1wOmDLrhDmZW+OAD7BImPme3y1K8Q07OGRM1Pl7LB HxBii4KFJscf24cbV9JH98/CPSm6coWz+IxUYMflaBXwDBH/G5sTC5hofTpsVgd7IsJr 61T5ifvKdpAce/wYZZINdDXffLZhoWV7YCIT0a7grSKCZMAogxYadMNmdSg5TAl6+FBb 4VvHQ38TGi3aaNrx1y7fEoyORc7oxGjswjlum+ieirpuCeXV0IrUYQrgBR+Wa0vBanDF ue6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=srD8tATI; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76618-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76618-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id oz20-20020a1709077d9400b00a3f8e239e23si466448ejc.801.2024.02.22.05.44.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:44:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76618-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=srD8tATI; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76618-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76618-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be 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 E76A91F271F4 for ; Thu, 22 Feb 2024 13:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A836B1487F6; Thu, 22 Feb 2024 13:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="srD8tATI" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C8612FF73; Thu, 22 Feb 2024 13:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; cv=none; b=DVy2kHCFDXlONDGn3XT0ftO5jbrqUYBmlgoylj7vpRPvsuV9fJGpw5lX8wgMLOH6p/NpgHs5kyvsAoHH7N3TrjBWO+HACHM2fLLxFdNQbut0ooErsqqfje8WkmPw34jo1gGyArNE4UvRJPiEmh3FaAxI6eY6p4cmtUFcrkRMmsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; c=relaxed/simple; bh=63q07220oMSPgby8d2W559AqbgLaS4GTvuUIbEXFtIo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kfQeEOEC+FT6wnI3KrzCnCvH7YKHBSdAs81Xfb1dWMWKB7jttcoITRHu3PiK0TYMpIa11vA3A2oWKYONsrrZcS1igpeEZW27AudUcAiwOUlf48zBmzlS3Fid1uOY5i6a0rvoJ9wuAwf2isQyQBfybu2xc0qwp6cn7Dy+bYkurU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=srD8tATI; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 50C63200DF8A; Thu, 22 Feb 2024 14:42:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 50C63200DF8A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708609357; bh=ntM1lJl9v7kyuGzcxYVa7L1YvVosnIeM09eUzJVM3Ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srD8tATIIW4Beu36+NZCx685H5fNVEFmgDarHvK3SvBJoSRApxGhihTbS1IS2cJut W80MrrKJ2NvCDWggGR0R1d/RNeZTxJPMOvrKaxLie9z7Q636UEnHUyNHNFBBarYrMt 9M5FkNyD6iYlP8FpE755nh6t5em7fYnu1p+BDBVQTHacMf7lFHI4sSn/GOFh61pGdh X3DYSpm+Sxzlih5UxVubatA+zSTz5+scQoSCAONmg0N12ZdpTjcnfrHkhW9Fsx/2lP yqZwks8+CyWaaPkbmR4xRnZd5vOOHvi5rCKaUZCmARAr/NxGRmpGNwLlHckFfT9w3a hlRGYG7NZtRtg== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v2 1/3] uapi: ioam6: API for netlink multicast events Date: Thu, 22 Feb 2024 14:42:18 +0100 Message-Id: <20240222134220.16698-2-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222134220.16698-1-justin.iurman@uliege.be> References: <20240222134220.16698-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791606853599291082 X-GMAIL-MSGID: 1791606853599291082 Add new api to support ioam6 events for generic netlink multicast. A first "trace" event is added to the list of ioam6 events, which will represent an IOAM Pre-allocated (or Incremental) Trace Option-Type. It provides another solution to share IOAM data with user space. Suggested-By: Paolo Abeni Signed-off-by: Justin Iurman --- include/uapi/linux/ioam6_genl.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/uapi/linux/ioam6_genl.h b/include/uapi/linux/ioam6_genl.h index ca4b22833754..1733fbc51fb5 100644 --- a/include/uapi/linux/ioam6_genl.h +++ b/include/uapi/linux/ioam6_genl.h @@ -49,4 +49,24 @@ enum { #define IOAM6_CMD_MAX (__IOAM6_CMD_MAX - 1) +#define IOAM6_GENL_EV_GRP_NAME "ioam6_events" + +enum ioam6_event_type { + IOAM6_EVENT_UNSPEC, + IOAM6_EVENT_TRACE, +}; + +enum ioam6_event_attr { + IOAM6_EVENT_ATTR_UNSPEC, + + IOAM6_EVENT_ATTR_TRACE_NAMESPACE, /* u16 */ + IOAM6_EVENT_ATTR_TRACE_NODELEN, /* u8 */ + IOAM6_EVENT_ATTR_TRACE_TYPE, /* u32 */ + IOAM6_EVENT_ATTR_TRACE_DATA, /* Binary */ + + __IOAM6_EVENT_ATTR_MAX +}; + +#define IOAM6_EVENT_ATTR_MAX (__IOAM6_EVENT_ATTR_MAX - 1) + #endif /* _UAPI_LINUX_IOAM6_GENL_H */ From patchwork Thu Feb 22 13:42:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 204766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp258968dyb; Thu, 22 Feb 2024 05:44:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXTor0AIXNPtaRgnd7X7NtDj5XQ5SDCIcR40z/xCNmt61M7t36/hhz73Mcfq3Hst/HIbSPia5HHF2ViuMJyocaRXvEAKw== X-Google-Smtp-Source: AGHT+IEsz8jLVtBm4Tr/i5rDdqUdwlE1I7f5yEDojlNX9Rixrt/ZXWHFLaB/1v1YWbjM4JW/jRug X-Received: by 2002:a05:620a:1366:b0:787:3e6c:f33f with SMTP id d6-20020a05620a136600b007873e6cf33fmr23394658qkl.4.1708609440812; Thu, 22 Feb 2024 05:44:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708609440; cv=pass; d=google.com; s=arc-20160816; b=fMYB+F8R9XWhfFJNukWINmfbUJaRj23oldttMLSZZ0rXlU4YesEljPbJ1tdcEB5jTb Ullp8Qcl6WFP/8hkLmeTEsq4QSOSH4/2b0LqgRLzVOB2N3XI4eHo89Z/DjpqFhVO+Hho kybczz4kZicWXxYedzT2zYrJgUisSl6kQToDnSYfl9gPetgiODN1zNf+95my1Eofk1dB cCHLuu/zTpa3CQ3KvjbOSTQCvPcoqfx+4yyRKVumN5OjpFOnGTiV9r9a7vOX/LmOokDW YHd67tCNIgappkMNayKHY6mbqRB62SFklfDu7nI71CbXdwx8xRNCOyzyfUl9COH9xcit swCA== 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:dkim-filter; bh=hq6ndT35T0S7QhhDxp3zV7pZyTqFTsug9KaHtrGUSs0=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=TZXDoNzMhuUp3J3wjcd5ULxhW+yWizkkh/q2i3bJqjNQfFKt36oCQJk6NDrH1oy7l4 MkAW7+deUbXlxBhiwQPDIOJrQ2FRmRvCyW+fJhpE59BufpU56KtQqyzQND9mfbJKB1aR Pxov7VyUx5GNTIycZ72nzQyRm7CiOvXHJR8AQZhRSRAnqX+Zxh26wgVa3Yk540gBnM1M Re/KYXK9YJqEhT3nJeGEgE4fPi5h2Dq+Uz6HnqC7CbmarNya8xGem3EB2puMkaCUgiQ7 7SzgV1WpvJda6lZ3LzBXJc6QRLoeoxg91aqa9UNOeoJqn9V6hjxBRA4UWvbxhVHGYnW+ XeXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=1A+aMNqu; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76617-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76617-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v5-20020a05620a122500b00787236cdb49si12515681qkj.649.2024.02.22.05.44.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:44:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76617-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=1A+aMNqu; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76617-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76617-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 939EF1C23B91 for ; Thu, 22 Feb 2024 13:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2B371487F9; Thu, 22 Feb 2024 13:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="1A+aMNqu" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71F93131720; Thu, 22 Feb 2024 13:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; cv=none; b=BX5932B3gkklDVOzMvxOrEECGRD53EH+QtDTxhBp44pzUM4nEjAwIwPvYOxnm0cbu2LsHH0ofxPZx8CJ1veu1swO2OF5aKCzdHnSZxXTC/Zc9ll+722vFTzyEZYKvHf5Gt0978ZiaNSiAJ1qSlQVCgpfSUnf+bs5vFojJi6YzoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; c=relaxed/simple; bh=XN/Z2W6Q47kswIvugAyf+0JDBepLSAUiKU4MFYhPfmY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QgN/ZUFoA9N2W5B5tqKPRqBrvX3dvLlIGewRbqX5FkO/Vffuhh7miiP8M/rr4kKDDl0WOJ01KOrCxMTA8kJUkZSqEyBq/29EvIdIKbf0s8MnCygIjyrE1rzs5eEw7daDtTVvzcZPk8Lq/N7ee8jYZELa5t6ak8YH6HVj+hbeJuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=1A+aMNqu; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 87EB9200DF8B; Thu, 22 Feb 2024 14:42:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 87EB9200DF8B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708609357; bh=hq6ndT35T0S7QhhDxp3zV7pZyTqFTsug9KaHtrGUSs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1A+aMNquuOAkG4srgI3mumI/VG2cDZalI23BgDCwLfgPn47Sy1G2eh5Zni3VQBTiX 7ip7Qq5mtPRfr0IdqmaDez/vorkqn3ajiDQFn6HCYgNw2DV5JlvKbRin9mT79E5Wo2 CpSCpX+3x34APjSaskZFPX1v6j4IYB1bdtSSDlK0UEBE//Ai33OncIdIbBYJbiDHB0 whrJzlAuERKlpMw16lgIX7hXY6y8+8P66PHz1kfJPbndgYBgZ6YQ8W8F3cpNW9VNGR fz5nGsRNz5USLUCWdIz1wAXVjrEgPhx3zsLBBpCxLL4tlMctwO6CksPQFI1GL8pVws cbxAoe5BRarWQ== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v2 2/3] net: ioam6: multicast event Date: Thu, 22 Feb 2024 14:42:19 +0100 Message-Id: <20240222134220.16698-3-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222134220.16698-1-justin.iurman@uliege.be> References: <20240222134220.16698-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791606853276115332 X-GMAIL-MSGID: 1791606853276115332 Add a multicast group to the ioam6 generic netlink family and provide ioam6_event() to send an ioam6 event to the multicast group. Signed-off-by: Justin Iurman --- include/net/ioam6.h | 4 +++ net/ipv6/ioam6.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/include/net/ioam6.h b/include/net/ioam6.h index 781d2d8b2f29..2cbbee6e806a 100644 --- a/include/net/ioam6.h +++ b/include/net/ioam6.h @@ -12,6 +12,7 @@ #include #include #include +#include #include struct ioam6_namespace { @@ -65,4 +66,7 @@ void ioam6_exit(void); int ioam6_iptunnel_init(void); void ioam6_iptunnel_exit(void); +void ioam6_event(enum ioam6_event_type type, struct net *net, gfp_t gfp, + void *opt, unsigned int opt_len); + #endif /* _NET_IOAM6_H */ diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c index 571f0e4d9cf3..5fa923f06632 100644 --- a/net/ipv6/ioam6.c +++ b/net/ipv6/ioam6.c @@ -612,6 +612,68 @@ static const struct genl_ops ioam6_genl_ops[] = { }, }; +#define IOAM6_GENL_EV_GRP_OFFSET 0 + +static const struct genl_multicast_group ioam6_mcgrps[] = { + [IOAM6_GENL_EV_GRP_OFFSET] = { .name = IOAM6_GENL_EV_GRP_NAME, + .flags = GENL_MCAST_CAP_NET_ADMIN }, +}; + +static int ioam6_event_put_trace(struct sk_buff *skb, + struct ioam6_trace_hdr *trace, + unsigned int len) +{ + if (nla_put_u16(skb, IOAM6_EVENT_ATTR_TRACE_NAMESPACE, + be16_to_cpu(trace->namespace_id)) || + nla_put_u8(skb, IOAM6_EVENT_ATTR_TRACE_NODELEN, trace->nodelen) || + nla_put_u32(skb, IOAM6_EVENT_ATTR_TRACE_TYPE, + be32_to_cpu(trace->type_be32)) || + nla_put(skb, IOAM6_EVENT_ATTR_TRACE_DATA, + len - sizeof(struct ioam6_trace_hdr) - trace->remlen * 4, + trace->data + trace->remlen * 4)) + return 1; + + return 0; +} + +void ioam6_event(enum ioam6_event_type type, struct net *net, gfp_t gfp, + void *opt, unsigned int opt_len) +{ + struct nlmsghdr *nlh; + struct sk_buff *skb; + + if (!genl_has_listeners(&ioam6_genl_family, net, + IOAM6_GENL_EV_GRP_OFFSET)) + return; + + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); + if (!skb) + return; + + nlh = genlmsg_put(skb, 0, 0, &ioam6_genl_family, 0, type); + if (!nlh) + goto nla_put_failure; + + switch (type) { + case IOAM6_EVENT_UNSPEC: + WARN_ON_ONCE(1); + break; + case IOAM6_EVENT_TRACE: + if (ioam6_event_put_trace(skb, (struct ioam6_trace_hdr *)opt, + opt_len)) + goto nla_put_failure; + break; + } + + genlmsg_end(skb, nlh); + genlmsg_multicast_netns(&ioam6_genl_family, net, skb, 0, + IOAM6_GENL_EV_GRP_OFFSET, gfp); + return; + +nla_put_failure: + nlmsg_free(skb); +} + static struct genl_family ioam6_genl_family __ro_after_init = { .name = IOAM6_GENL_NAME, .version = IOAM6_GENL_VERSION, @@ -620,6 +682,8 @@ static struct genl_family ioam6_genl_family __ro_after_init = { .ops = ioam6_genl_ops, .n_ops = ARRAY_SIZE(ioam6_genl_ops), .resv_start_op = IOAM6_CMD_NS_SET_SCHEMA + 1, + .mcgrps = ioam6_mcgrps, + .n_mcgrps = ARRAY_SIZE(ioam6_mcgrps), .module = THIS_MODULE, }; From patchwork Thu Feb 22 13:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 204768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp259000dyb; Thu, 22 Feb 2024 05:44:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU3r0ux+gAoOZQTK5VdQ5nNH7g/+TxRmdgDKP77Q10MqVFo02v2iqC5Z3XvT3wzhonrVlmo5ptK4ov6EQaOU287KwqABA== X-Google-Smtp-Source: AGHT+IGDPZxiSVuhsdk9+5ZRpoQquMuaOsIbzukT0IYP+UtL6xDMF9M6aiH1eTbKJnWX0czXLej+ X-Received: by 2002:a0c:9c8e:0:b0:68f:c2b3:4671 with SMTP id i14-20020a0c9c8e000000b0068fc2b34671mr927841qvf.62.1708609444815; Thu, 22 Feb 2024 05:44:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708609444; cv=pass; d=google.com; s=arc-20160816; b=oLHwuYrfghejYY1VAKfPanfEILkWRPsP3DzrtS9wodj3rCo4ai7lwnJDqm/4nkWnHG SOcvSu0OTMdRGJp5ws2NXlVPHLSbuY9dnfwg9Nv4pDCRRUISnAgvt2xKca91nHNA+Abh lllSoO0kPnRexidAZNOVHTXWSR/cQorL280vJpAzjzRjDwXtIcNbiCMqQ+wjUrNF5Vs4 x9Vd3qYEMu7uJCcccO7ONHZUDLZqLa/jZRwcvCu2RIQp6E2nlYaynGumnYpBq+CeT62r XtkO2gW5VoPgF3PkTeaVNn3FjxmT4R7LezL5ar3ivvPiDRHsW6KuzuTdZxdE+BmWNiO9 MSww== 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:dkim-filter; bh=ohnw1X5t6/nbcUS24rw3MYJUUJQ4h7ERcV3d3m5S1+E=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=xPKQaQ6SwhT4Rcl5qIUMvVYhqwqg/m153ferIj2LZYFuAmP0UC39vk0wYwizK+x6a5 feFauhE3NRiqOS5+07L9/iAs/YCCkyKn0d58gNYOxp2QCiLb5YL2saEUPPtVbmUtHjPj 6oKiu+Uxvqv1Lh74SbH0lB2TCTmSuVJDuZ1hwCiQdPnCNgRswXKw1nj1PL7Ss1S1jeq9 16MCaAYcsppqHSTlhzAEDLm+dchFOWhjOsgL+myTWU/aAieH+bJPsHXdNMSEFiENFR1K auLWICsetf5OOrTHFrm8MOLVQdNgGXiV+JrPu5wUJEQaDA1hCI20+qMEACIfK82ZOW2P 7q8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=iisk8n9p; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76619-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p13-20020a05621421ed00b0068f74b25787si8078669qvj.306.2024.02.22.05.44.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:44:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=iisk8n9p; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-76619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76619-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 990A41C23B91 for ; Thu, 22 Feb 2024 13:44:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF7E6148FF2; Thu, 22 Feb 2024 13:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="iisk8n9p" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A60C9134CC2; Thu, 22 Feb 2024 13:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; cv=none; b=nrOoXUUadaIWHRUhNZKTtePIxu2LM6lSCXORiJc/gJkyJgPNHbTVqrdjJ+hlAD1rQGHbhHir751LSl0XS3xsRM4920eE/n3O3PkdXdcm4Csez0X+HnzTJowdcMXQ9qYmLbcY7TntDuyHQxelK8ubS7vOMTxwA8+4lwYxx2ri85Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708609367; c=relaxed/simple; bh=w7q0OZpmbQ4iJGkY22z3KyxTMX1Cmy0aLTK8x/4EEWI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RXmwjAaYWvU7l8ypgDYem2CIkqg9YyuRlGC6Gd9bbBN5BRfB4eDw2VSwNQGIOluktRkM2kJXzPE0rFqNoX/MV79WU0Wx6lXGrNS4A/f+I0CdiG1X4kswWN/iEG9stYpFm/LcnUIQJPwvMycFBZheZ9clxuXMlplEE5Dmh0drK1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=iisk8n9p; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id C0278200DF89; Thu, 22 Feb 2024 14:42:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be C0278200DF89 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708609357; bh=ohnw1X5t6/nbcUS24rw3MYJUUJQ4h7ERcV3d3m5S1+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iisk8n9pS1HSF3c9g4DMHVKKJ3d5eaY+T4E/6zmc5LwNR8UV3FM0A23LacqY+FYFY RElvkOd88KFwQITaK0vcRozx/3P+vPYH+RbKAaS0IBM69aa8lYVmKmB1RyZk2MqIGF Uksz7mjdoPgXloV+s+jDfWPCX/v+PGdZS/3w8ZJ+RfTRJcvlDe7+yZtrvpruV85muR DyG2cVccIt+cRjlQ4vC+J20oxj1WY3ONiEfRjPRpYFRzXfeKurfPS2fKXeSJ5kygvO /nagO7TU9zg+Dvuv+TLWBesVpul5mleAAIodfNay3QXBagpnd2BStNqc43HjSKcBP7 b9BYep7N1kvOg== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v2 3/3] net: exthdrs: ioam6: send trace event Date: Thu, 22 Feb 2024 14:42:20 +0100 Message-Id: <20240222134220.16698-4-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222134220.16698-1-justin.iurman@uliege.be> References: <20240222134220.16698-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791606857068350665 X-GMAIL-MSGID: 1791606857068350665 If we're processing an IOAM Pre-allocated Trace Option-Type (the only one supported currently), and if we're the destination, then send the trace as an ioam6 event to the multicast group. This way, user space apps will be able to collect IOAM data (for a trace, it only makes sense to send events if we're the destination). Signed-off-by: Justin Iurman --- net/ipv6/exthdrs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 4952ae792450..b26dcf4d0239 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -50,6 +50,7 @@ #endif #include #include +#include #include #include @@ -944,6 +945,11 @@ static bool ipv6_hop_ioam(struct sk_buff *skb, int optoff) ip6_route_input(skb); ioam6_fill_trace_data(skb, ns, trace, true); + + if (skb_dst(skb)->dev->flags & IFF_LOOPBACK) + ioam6_event(IOAM6_EVENT_TRACE, dev_net(skb->dev), + GFP_ATOMIC, (void *)trace, + hdr->opt_len - 2); break; default: break;