From nobody Tue Feb 10 09:59:50 2026 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 52B017493; Fri, 23 Feb 2024 14:41:50 +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=1708699312; cv=none; b=c4w1mI2NDpE25dI89mXlQeJchifTPZowi59Q3fqmuSk4Egi+4BkTnncPd31vMYAFx+PTCjWP4IyUfLIsnK1C1BlhbpcocEtHpT5DsofZVy/abP3TUoYoMfmUW6q3VbJywvgMFnogGXrVC9gh/KTObMvWjo5Y4ZeyssRtiYM0lEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708699312; c=relaxed/simple; bh=lYSbqhb9aelgiyV2bHdQgyY0ObK/yrK8TqQKdtUu/qM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ekGqSvyO2dIChQMBavP2lYBXUtaRJjW5hnD3x0hlKOrxgP13ILBufosLlWQDCxLzN7d0HlDg/XGcZ7HxFMCrL8XFb4wyXFXekHjPWDIYXX8upPh/jXQCm7Ve9MlCoqTpljbCanYEfy8cLicGLFhFYdgGFTELJrqVfLlOCy6Fj90= 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=lpuxA5Fp; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="lpuxA5Fp" Received: from ubuntu.home (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 64142200C982; Fri, 23 Feb 2024 15:41:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 64142200C982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708699303; bh=LcVhwtN+UqJjMSh3FfAL9zHi7+WPp9yvrVRqAgObzSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lpuxA5FplMiOqb/KbsHnDkgK9+wxn6OZTR4X17vi1Za2CxMkPSP95T5NOS8oJOTtX Qdh3fos5tVvMNnksWZeyYT1JPnFslBUX17zHkwWvgzW4A2ktCyU2SQtufOO6LHZAmF afDM4Fx7S+ISfovXy2zQy7IB2xG/GD0T4U66tzkC0nQCSW7xam2JXX9YR3fmIbLw+4 b0fPKj0yWmaP7jAPuFEImXh4FLpdBHFqgigPbTgzIG1btadvch0Xu9nnsxbEocNMP7 4cy/aHy0uluXUYwV3UP7VhPWY55fg/zAJjFe5hI33iIkbyz90QmTIdh4gGGeA9Vxvn zv62Zmu82IhjQ== 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 v4 1/3] uapi: ioam6: API for netlink multicast events Date: Fri, 23 Feb 2024 15:41:33 +0100 Message-Id: <20240223144135.12826-2-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223144135.12826-1-justin.iurman@uliege.be> References: <20240223144135.12826-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Justin Iurman Reviewed-by: David Ahern --- 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_gen= l.h index ca4b22833754..1733fbc51fb5 100644 --- a/include/uapi/linux/ioam6_genl.h +++ b/include/uapi/linux/ioam6_genl.h @@ -49,4 +49,24 @@ enum { =20 #define IOAM6_CMD_MAX (__IOAM6_CMD_MAX - 1) =20 +#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 */ --=20 2.34.1 From nobody Tue Feb 10 09:59:50 2026 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 8E3586FA7; Fri, 23 Feb 2024 14:41:51 +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=1708699314; cv=none; b=QTjBkzFKyGloqXeM2tGTcX5tUrnopE+/fbviQi1QoC54P6JaZOqePn306pfyiNZLMBu3UdPZG0HRXInMc7AyYMAwaOlTNK0+mDy8rsrFm6F7ZtbNn6cetyATogNJmsLzNoXeaWjm9ZTY8JiEFjR4C7Qk7Jk+UaIk9UXqguZ0O54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708699314; c=relaxed/simple; bh=XN/Z2W6Q47kswIvugAyf+0JDBepLSAUiKU4MFYhPfmY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ExWS4vcneIJlnOIgZFrJCfDJJjvnBJYOneLCm5uRBXKcoeUGpXfSklvKdEg/7Flm0OYUM4ITrYPJaWsBIWhLOkD22B8pShuoytnAM600QetCcSUPmRLcx2CZnrM7NSUHQJUlMYzKsoAix/+36xV26HCG4hVN/PK1jXa54VRCki0= 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=n/eeu5bV; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="n/eeu5bV" Received: from ubuntu.home (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 9C2A2200C983; Fri, 23 Feb 2024 15:41:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 9C2A2200C983 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708699303; bh=hq6ndT35T0S7QhhDxp3zV7pZyTqFTsug9KaHtrGUSs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/eeu5bVcgE/VBkBM5q8DLHy8yjO40/BS1ukoudYl+nFlrgghdzrHypOSDzkKPOth eA6mV2R6vIpx1T0nFdO/01qjld6XY+CiZDrF5melZlfiCYU0/hmt+RpqdiDC2VFJn4 mYcj208RsrXarva041udsJHU9HosavvMM1JGiGEk8WymDDQr3ghHwjBJkYTvlv6+pd etStCueFtzWsmyPk+630Zxgjvsm+rwGsMSVvljm/hv7dnolY1RMyuUERWp/s7mQ5zM sQnzFKWqSA5Kss6vOIWndJ7TMbiPKafbI+2CdC/1oz2wo87qHqPYJt2tPqsi2LH5Zl nXO5j5dAdA9DA== 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 v4 2/3] net: ioam6: multicast event Date: Fri, 23 Feb 2024 15:41:34 +0100 Message-Id: <20240223144135.12826-3-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223144135.12826-1-justin.iurman@uliege.be> References: <20240223144135.12826-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: David Ahern --- 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 =20 struct ioam6_namespace { @@ -65,4 +66,7 @@ void ioam6_exit(void); int ioam6_iptunnel_init(void); void ioam6_iptunnel_exit(void); =20 +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[] =3D { }, }; =20 +#define IOAM6_GENL_EV_GRP_OFFSET 0 + +static const struct genl_multicast_group ioam6_mcgrps[] =3D { + [IOAM6_GENL_EV_GRP_OFFSET] =3D { .name =3D IOAM6_GENL_EV_GRP_NAME, + .flags =3D 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 =3D nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); + if (!skb) + return; + + nlh =3D 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 =3D { .name =3D IOAM6_GENL_NAME, .version =3D IOAM6_GENL_VERSION, @@ -620,6 +682,8 @@ static struct genl_family ioam6_genl_family __ro_after_= init =3D { .ops =3D ioam6_genl_ops, .n_ops =3D ARRAY_SIZE(ioam6_genl_ops), .resv_start_op =3D IOAM6_CMD_NS_SET_SCHEMA + 1, + .mcgrps =3D ioam6_mcgrps, + .n_mcgrps =3D ARRAY_SIZE(ioam6_mcgrps), .module =3D THIS_MODULE, }; =20 --=20 2.34.1 From nobody Tue Feb 10 09:59:50 2026 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 8E3A479CC; Fri, 23 Feb 2024 14:41:51 +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=1708699313; cv=none; b=cZfsH2DFOWiuV23RoY+E0SGWbMjwl6QkuVYpfIe7GnBQ/R1kzb24qPhGnhK7VPdosxmB7nrCX3l3K/Bj9tvmXiR5cSQpN6J12osKXSrYEOlF5p9OsicdrAFaWLutnoEP3Lhb3Iw3C7/+RIc0uOtSmkNbSl9RYu5TCzwyToc6r2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708699313; c=relaxed/simple; bh=ZlQwc3wckbIo6B/IZ6QBbkjJIGAEVMnxpMBxl0bFrYE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OKdk+y+CSJ9deFkA9Vhxfl84XR7XsPf54wY8EhJsz3e0GFne2KbDx17Jp8CHtMRvVqO6Srj+uHe8u/xI7ZkFJJXEDeNqATOgGtKM06iGB9kUuyYSoDlsYdgFXTqysH+ay53llDwHtC1qA/mPE+6Rvv3Xfvvc6W0vZ0BbCbab+5g= 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=0BK9JCuA; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="0BK9JCuA" Received: from ubuntu.home (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 D3F1A200C984; Fri, 23 Feb 2024 15:41:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be D3F1A200C984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708699304; bh=UcUfAXN6JVmIsLlMmJXJirrwKr6+ad6fgsDvkrq6I2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BK9JCuAPXlWKMScVZcUjJqUJOZohb9t1vFW4v7P8IQ9i7ZZx1dQOo0t3Kp6uBQIn Po4XV628+Idoybnu7gLedNSmhDd1fqIzjWUve/Nh+OrjzcLe0UXzIUnxo42a/GzSFw Xq/xLr/nQ9JE4yTYRZqsC2QefF5ywFeLvzZEtjXJaARPQhiLoWL4j1jR3Uy4j8SxBE 1ToGbyr4UamAPV2lvSmRSZW6Kp61/JumgjhgQtd8Md3vTArOxC+c26KxHbNWUzKJ+b LmU4CZi4HG0Gdw80sDPNuFCqPIHAgaw5V70qt209giaAtKhe/g8+wZvK9qwjzZOvEm 9EzWBOfhL5J1w== 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 v4 3/3] net: exthdrs: ioam6: send trace event Date: Fri, 23 Feb 2024 15:41:35 +0100 Message-Id: <20240223144135.12826-4-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223144135.12826-1-justin.iurman@uliege.be> References: <20240223144135.12826-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: David Ahern --- net/ipv6/exthdrs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 02e9ffb63af1..003f35d9b42b 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -50,6 +50,7 @@ #endif #include #include +#include #include #include =20 @@ -954,6 +955,11 @@ static bool ipv6_hop_ioam(struct sk_buff *skb, int opt= off) + optoff + sizeof(*hdr)); =20 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; --=20 2.34.1