From patchwork Tue Feb 20 19:44:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 203782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp630040dyc; Tue, 20 Feb 2024 11:51:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUI+245qV+BCj0kdMh3e3TgxQ/EFvlSEpuLlfXA2ahFRYzUPs9JGTmxevFu4FG1NNOjPmiGMlWHMFyGI8X5BDZOIuay0g== X-Google-Smtp-Source: AGHT+IHRq1c6kA+H9oATySVwK9fXN5js21mizdDvzW8g2o87Xyn0Jp+eRVG8r0naO2j8vlCsj2j2 X-Received: by 2002:a05:6512:308d:b0:512:a8bd:4bee with SMTP id z13-20020a056512308d00b00512a8bd4beemr5976390lfd.45.1708458694191; Tue, 20 Feb 2024 11:51:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708458694; cv=pass; d=google.com; s=arc-20160816; b=vxKEbMoNc17c9zkZRXJdlFK2UsWY79kkWefagKbvEE2x8+iFhi3MsBwzDRVehj6RBS E4gk6+qNimvxrfkOA2qTpRpmD89UMGJzaY8KNnVZMP79JDUYcEVe0rWYBWiozSkUOyef e3luU4Spf7onNeRolMsZ6SUaPOLPbK7B293g8Ke4NA4FKL/lY4wqwJlXy/0RXHW5KGRT ToVyBYgLH+7/uKtxJ6sg+NwpvJ9KCyWSCogWRImaJH7RawExpaHFt9jvJSFRRS4wETxE rNvNMaquMsWb0NuG0mdFuYnL7sptP5h1QwsQ07h3xCh8ChEzpFl/GS6mS2eWqa/FVczu jMnA== 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=L6uQoWV8E36c7sTdK4YsBrJRSuQm9ELTPqyqgTvcTrg=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=QOPPl9F195JDbM7lNSM3UT6zzdoZsJHaOQziP96qxxmDSYc59OV6ph6O8JkOmIiFQY 9REdXRUYIAayFMWTG10IaYHoS8vwFdO8ZhjiKKFCY8cQSNbesKI2Se0RtSD6wH6Q/qVt 2BAQj6kbmLm36ovJsFPWTbLwgc9F/xwlvm4Rvob2yyoajIezPle3z+gDkr7NwFfjwrDv jN29XykaO6uy4UfreXSQfBcjdWfP6NHfvXver0iyLpgNzg8htYX+ijuf63pn84M12O2+ PYdjKYojFrRR0j98Di7tHgVs2xCVgIrP7gdTw2ruwppbPcGx7jdVVWCxJNRYrtVYJAuB ylzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=EfnG1XlK; 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-73610-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73610-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 bx17-20020a170906a1d100b00a3df6ba2798si3238781ejb.853.2024.02.20.11.51.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 11:51:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73610-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=EfnG1XlK; 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-73610-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73610-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 DE0F41F25FF5 for ; Tue, 20 Feb 2024 19:46:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43C8814D444; Tue, 20 Feb 2024 19:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="EfnG1XlK" 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 7AED514A0B5; Tue, 20 Feb 2024 19:45:04 +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=1708458306; cv=none; b=P0FY0occA5mlIHEO58qLmRSgNo5FITdswKou0WBoxK6Te+GXsUf3JNG94eXk0QvRO2YEXxwMWcsOryD2uncGneC53SZPdr7qZ1AZ0i2LrS51zAh9LEzYZiRqVK+NNiVLmpd4qnF6n2ckSvbft1ihtPdbIMrZL4vsPz+l+Oe22gY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708458306; c=relaxed/simple; bh=xDvA4NOSaHeI0LBT+9dOO/oYhDt7h7z7NwciBr/tMGU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GWHU+jqcFQOyGc66fxZhGmAHsIriWR95A8MQsvNq5+Oc9U+YKKMe2Qv8DtYZXK3Z05DWNPxn33Gm/1g4+bwvM0KMukeCQxjpFYphgpmLuft3HcDJsQHct+BbAGHlYf79LGVNAjLwEdDqhL7wQYJYtxcEqIMiWJ+nU/U5WoF9uD8= 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=EfnG1XlK; 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 578F1200BE63; Tue, 20 Feb 2024 20:44:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 578F1200BE63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708458297; bh=L6uQoWV8E36c7sTdK4YsBrJRSuQm9ELTPqyqgTvcTrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfnG1XlKxx6HJYxNkJuRa+ksJ6Mn7KjTQOi0nQGXeOQbqdbmWIP+R4yTxWdtSh7gu TJ8MEgsNVrdfeFBz+1yhkjw02j7j7eGZi0X8IxDisfsOOKZLNMLNYOuwsYTB7qH6I7 eRAmuSWjvuShTjPLEROKfjbXUsVmKH+ar8UHEnOUHJsxxAZcciivEaQGJ9xtdrGZtd +iidu+HgjmSKitYQCDOGHlTdfGPPZSl7hbJ3474wJSuquxFl3s/ZECLjBWc3tnLPlE SQLnwpNI0dRf/3TfhaINWIdzGQUvMIj50TLzHy7AxYOaD4rqqtTo4TxmXeEHDSJFwt GKJ4u+9iEQbtg== 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 1/3] uapi: ioam6: API for netlink multicast events Date: Tue, 20 Feb 2024 20:44:42 +0100 Message-Id: <20240220194444.36127-2-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220194444.36127-1-justin.iurman@uliege.be> References: <20240220194444.36127-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: 1791448783932802009 X-GMAIL-MSGID: 1791448783932802009 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 Trace. It provides another solution to share IOAM data with user space (an alternative to IPv6 raw sockets combined with ancillary data). 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 Tue Feb 20 19:44:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 203779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp627977dyc; Tue, 20 Feb 2024 11:46:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUG69699+8S38rdJh6AfAvAMkjUleXsrjYM0QMNMFre51O+u7RLDwpy7+25PA8abUJiQAjr8eTnmhijx39P6SZwDKS+BQ== X-Google-Smtp-Source: AGHT+IFd9IRr37yU4VYr9vfcIuE9uswsLSd75UKttono1jvkwkkjR4H6r44khAeebRx5N+BmxJZw X-Received: by 2002:a05:6870:e88:b0:21e:90a3:1871 with SMTP id mm8-20020a0568700e8800b0021e90a31871mr11662476oab.50.1708458389566; Tue, 20 Feb 2024 11:46:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708458389; cv=pass; d=google.com; s=arc-20160816; b=IOHC/E1ShBSl7xJAGQJo+IF1yTvSSBGWMYYQtFUlZSgaAb1X6vhzeg8DzG+fU5/eQV B0N4JvAj4l7ouGwAy5PA8vYAF6oSt2Zn7du1MxtByBqhejr3HGxjogOujJDj+6vvKliD /DUNXmvzBLeQdXBtJQ9DLFSPFMpY/kLuhIN0szS1pUpQJzo3ltJkwR3AFtlrv+r6sjmO z//ThVr5Oq7kipfWsHPctSe+NG6H3TGLPYFxBl7hzyks1oWVzk9pTyXDUeeRsyIMpXiP RSiNkdGkU4Vw3sBaTX+VCWZNt+HAo8lPCS5qUTiqSO/5zJlE7QJAN3VNyhSZMDv2JUeW qOeQ== 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=EQKW8IR6daFC9rmvP/2gxPZD4UEOkx+/5Gcd40M3yCo=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=wG/ijadzrqSWBId8Zjfh0lRVJzVYTCHXqL2mMWGGoOBj1+qIuRx2ctTu/BWPIROz40 etNQQtN/ZdaQ2FMJIcMEk4kP3QxN3K+F2PE+Snj2kqAwPwyZvzI1L1GCbAD/dSO1Y39d kpYK4gqSrQwr3UQZ49QIHdHUKhj6+cNWKECyruW5bcOsZjxb2pg1jLZiBy8+oDi8W9l6 T7hjDxZhtIk6wnBJY0YrGO9NBFfVq/sh0PmcxtZ8uipSMRqXKeoOtdlUCEjlX0eMJZg7 pkHKrC5CGmFf0AifK6/V2auS3MhK3iZDURwiHZ8o3fZlPdH8wnziEJY+zcXekn0IeZGo AOqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=op7LIGff; 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-73612-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73612-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 b22-20020ac85416000000b0042c70895fbbsi8868974qtq.100.2024.02.20.11.46.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 11:46:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73612-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=op7LIGff; 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-73612-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73612-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 4C15C1C225A0 for ; Tue, 20 Feb 2024 19:46:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 197B614E2DC; Tue, 20 Feb 2024 19:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="op7LIGff" 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 C84E06A8D5; Tue, 20 Feb 2024 19:45:05 +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=1708458307; cv=none; b=WcEqywyleOnz5QOtnHR5QQmri8L/p5trpnN1ViItaViv+H907FNYxfRvH6P6FJWXyKj9GLzysoRrWvmEQWF2DlHXR+hYVTABrfwVgK6YMH4sPcJbW858yO1uYHPh5cbvC8j7cWj2BSN2oqpoZtW0j6a9NNYPEDxQZGjBJMSZ7JE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708458307; c=relaxed/simple; bh=7bBKkv3ANKvq+h/O/HsveYbjpCdZKvN4hdxoLc3o95A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EKnMEIdnJtOmuYKlbdM/QjBUvuYJ8BCkJ9OZMxCuYB4hKR3jq+iEmvV902/H+CZwgbrYXkdh9KUAb1THsqxq92BCxA7KjwASkiKteYNW0VRC+URcIwZJaPz+JAxU+qP73vhCN8PQRvOL0goaDCJxKJd3kLno+1CxPQVQyBuLyp0= 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=op7LIGff; 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 98525200BE66; Tue, 20 Feb 2024 20:44:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 98525200BE66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708458297; bh=EQKW8IR6daFC9rmvP/2gxPZD4UEOkx+/5Gcd40M3yCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op7LIGffgaU+ndVFn3l4hM9W4GhbB6ncfjdYzRQb8bjz34H86k3ojyTd3yDnjwQWY Zd3fxjI66ANzF2EdLXYAWIqrnHstZDwf06upmtZnmkJ/i7kXQrNE06tUxAvCQQLqh3 DMvJCgc+0pJ7u/UDipJeH1qEz8m2COD3Px2CRPRG64YM6VBq9usSFy1xbUqWu8TscX OAAPC0MJAN4nHtgeWyZLod58uS4R1azrL4Z6+ooIUmjeAGYuMIbjA8xYBelcIsp1Ht jlsp2Vcu/k2U7kWYxoOrgfNn+P7sHh2ghU7fsyAzCIKRoZZQlfU5LYRqKYq5YC8jU1 hnEpw1ycQqsIw== 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 2/3] ioam6: multicast event Date: Tue, 20 Feb 2024 20:44:43 +0100 Message-Id: <20240220194444.36127-3-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220194444.36127-1-justin.iurman@uliege.be> References: <20240220194444.36127-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: 1791448464764270035 X-GMAIL-MSGID: 1791448464764270035 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 | 61 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 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..d06a406658f6 100644 --- a/net/ipv6/ioam6.c +++ b/net/ipv6/ioam6.c @@ -612,6 +612,65 @@ 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 trace_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, + trace_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_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 +679,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 Tue Feb 20 19:44:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 203781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp630038dyc; Tue, 20 Feb 2024 11:51:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUsWCKajDBF69vqqtFDVQQ7Fs8PktgL0uc+HvjEw645MZICA7RFxMNEUhUR8/xZr7/ZDffnAziF47qMD3BtyZ0kgGroQ== X-Google-Smtp-Source: AGHT+IG5SrXEcfNdFJhfkUSHcJtXYerNMGNMMvM+/X0SKvq6spSvxYSqFT/vZfRm1hntW99BNZW/ X-Received: by 2002:aa7:da55:0:b0:564:e4ab:a82e with SMTP id w21-20020aa7da55000000b00564e4aba82emr826731eds.22.1708458693981; Tue, 20 Feb 2024 11:51:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708458693; cv=pass; d=google.com; s=arc-20160816; b=CSbAjN2+cS6feDopYw5pm+huUOs1VXD5DEG3MeL5SNsE+6o6Jx25zhz5TdJ5gsnDt5 EOLjG6jxmQ6NKD5ON94JPj/5JksR8cyYxn5tsLxSH5wch64TC9UNn3Y7MXnBu6tJKGjO YU/K6v7Idfs02GyypOs2xresjNX9wkjORxtflOZEbPahSrHhCM7gNtzB64okUt95ikAb x7F6MLG+0L16XQhBGZoX6UB1bz1g2RJx1UtEbh4n0+D+9Cm3IrYfwTf/4i3FCtQsoat0 ZLMPvEFS9poLAS5Nd++wUitOM7TyoSJbO2zas0RhPG4ottTSu6NM4EDcDZqFeOuOrUnC Z2fg== 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=Pe9EOigSbPGpF/JFfAS5gTarqG/9sPOHJ5Ve/ZtXLhA=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=yjL2Loj/QgunjHT4q3g6OyxYbLhozrToeTouMfy8uU6VrXfdr7UOlT9XAMgD0+GGQ2 irFlPcOlN20nbr3/5WZi6R4nrkS9s1t0aA1DvFMV/8WKsQYVNOFOPjeO4qgSg+YWrNY6 i3buV57BYqiljgLMXWDqtvKX+tGt46yjDuYXpkQBLVG74avUYvrGC4KFBTmhg3RtA2uK ItOefH5KUj6r3ksOJOPoZF1cqsnRb//xVHHRoBQL9NjzQjmkzZ7Pv0utq0PjRwtRN7hr k/jDACZxdMX2lBMc63OTQxSMjBOkBnKE7IKOrDe0k4KZWqPuETuBUMGIMwMwc3Y+WiCS ysqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=DufjJbr4; 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-73611-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73611-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 cy28-20020a0564021c9c00b00560c04e1625si3535666edb.656.2024.02.20.11.51.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 11:51:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73611-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=DufjJbr4; 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-73611-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73611-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 D1BC11F260FB for ; Tue, 20 Feb 2024 19:46:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F138F14E2CA; Tue, 20 Feb 2024 19:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="DufjJbr4" 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 C8524137C41; Tue, 20 Feb 2024 19:45:05 +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=1708458307; cv=none; b=ZiLWIUPNvPFpsb0Jqzw/gOWaPTd0bQSjQkoHFAdOj0lQdmIdWsdBUKz87cWs2PLOSq0BLlbB3bI36N/ZdbfFeYVIFWLH8BNsU/NGHK5hsOy6Ghf5HQVY2ZazaVFpOfJbzXSvikv2dOAwuBG2eblNz1QHPY7NIACYAuOkeoudGDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708458307; c=relaxed/simple; bh=Mwj0/typD3aTrSkrgEntFoxq41yM+vCVAdUetDPy270=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PF7T06jlGZpFbNoe5NX9Q3u70jeTccB99h5QMNhEtsX0SZ2lhwXfYNHKwHqF0x3yIjhIBOn//PzNOxLgZaDIGeuIdQgt8FcnHiurxCKPilWKV9cVs9rEYTvuR9/gd8hLccd4wYdcwIn3MAJtCpxHJN9W8KcmNauuB2Gd4xiYkYQ= 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=DufjJbr4; 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 D9330200BE69; Tue, 20 Feb 2024 20:44:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be D9330200BE69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708458298; bh=Pe9EOigSbPGpF/JFfAS5gTarqG/9sPOHJ5Ve/ZtXLhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DufjJbr4Mb6yBTitQ8EZjumKp4w2/Pw+Yk+/JobeoAwKGXo/7nWVlb6DlnU5NVxcz YpsqLHgfBZvq8iM2Ymz5PJpUfhsFpO5Y0CQbW4NiqmkpMd7yB0j+FrM6aIiNKmz/W+ aqaZ55z2obxZjIcPBVnz6t8+Nc3YXnXaZA+4H4KhGYOScqEAQ+swSDR8183982q4b4 3HVAIcxe9AQ4+IH23UvM0z4JqXZLRqmOFEYwVmIYegtuysVgRfcC5PaJ3CAnAEfET1 shPYohahtlZuHvB7TkEfMqf3gb33qj9wQ+UKCpbnqsihdRZpYVvEyDaa3eMYRIWxMI lEjnr94y5EzXQ== 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 3/3] net: exthdrs: ioam6: send trace event Date: Tue, 20 Feb 2024 20:44:44 +0100 Message-Id: <20240220194444.36127-4-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220194444.36127-1-justin.iurman@uliege.be> References: <20240220194444.36127-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: 1791448783416724941 X-GMAIL-MSGID: 1791448783416724941 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 4952ae792450..d1f96a28e190 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -50,6 +50,7 @@ #endif #include #include +#include #include #include @@ -944,6 +945,10 @@ 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;