From: Eric Dumazet <eric.dumazet@gmail.com>
To: Justin Iurman <justin.iurman@uliege.be>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org,
dsahern@kernel.org, tom@herbertland.com
Subject: Re: [PATCH net-next v5 2/6] ipv6: ioam: Data plane support for Pre-allocated Trace
Date: Wed, 21 Jul 2021 18:46:10 +0200 [thread overview]
Message-ID: <37f96841-39ad-c9bc-0b47-b1e418c4d9b8@gmail.com> (raw)
In-Reply-To: <20210720194301.23243-3-justin.iurman@uliege.be>
On 7/20/21 9:42 PM, Justin Iurman wrote:
> Implement support for processing the IOAM Pre-allocated Trace with IPv6,
> see [1] and [2]. Introduce a new IPv6 Hop-by-Hop TLV option, see IANA [3].
>
> A new per-interface sysctl is introduced. The value is a boolean to accept (=1)
> or ignore (=0, by default) IPv6 IOAM options on ingress for an interface:
> - net.ipv6.conf.XXX.ioam6_enabled
>
...
> }
>
> +/* IOAM */
> +
> +static bool ipv6_hop_ioam(struct sk_buff *skb, int optoff)
> +{
> + struct ioam6_trace_hdr *trace;
> + struct ioam6_namespace *ns;
> + struct ioam6_hdr *hdr;
> +
> + /* Bad alignment (must be 4n-aligned) */
> + if (optoff & 3)
> + goto drop;
> +
> + /* Ignore if IOAM is not enabled on ingress */
> + if (!__in6_dev_get(skb->dev)->cnf.ioam6_enabled)
> + goto ignore;
> +
> + /* Truncated Option header */
> + hdr = (struct ioam6_hdr *)(skb_network_header(skb) + optoff);
> + if (hdr->opt_len < 2)
> + goto drop;
> +
> + switch (hdr->type) {
> + case IOAM6_TYPE_PREALLOC:
> + /* Truncated Pre-allocated Trace header */
> + if (hdr->opt_len < 2 + sizeof(*trace))
> + goto drop;
> +
> + /* Malformed Pre-allocated Trace header */
> + trace = (struct ioam6_trace_hdr *)((u8 *)hdr + sizeof(*hdr));
> + if (hdr->opt_len < 2 + sizeof(*trace) + trace->remlen * 4)
> + goto drop;
> +
> + /* Ignore if the IOAM namespace is unknown */
> + ns = ioam6_namespace(ipv6_skb_net(skb), trace->namespace_id);
> + if (!ns)
> + goto ignore;
> +
> + if (!skb_valid_dst(skb))
> + ip6_route_input(skb);
> +
> + ioam6_fill_trace_data(skb, ns, trace);
> + break;
> + default:
> + break;
> + }
> +
> +ignore:
> + return true;
> +
> +drop:
> + kfree_skb(skb);
> + return false;
> +}
> +
> /* Jumbo payload */
>
> static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
> @@ -999,6 +1056,10 @@ static const struct tlvtype_proc tlvprochopopt_lst[] = {
> .type = IPV6_TLV_ROUTERALERT,
> .func = ipv6_hop_ra,
> },
> + {
> + .type = IPV6_TLV_IOAM,
> + .func = ipv6_hop_ioam,
> + },
It is a bit strange to put a not-yet used option in the midle of the table,
before TLV_JUMBO (that some of us use already...)
> {
> .type = IPV6_TLV_JUMBO,
> .func = ipv6_hop_jumbo,
next prev parent reply other threads:[~2021-07-21 16:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 19:42 [PATCH net-next v5 0/6] Support for the IOAM Pre-allocated Trace with IPv6 Justin Iurman
2021-07-20 19:42 ` [PATCH net-next v5 1/6] uapi: IPv6 IOAM headers definition Justin Iurman
2021-07-20 19:42 ` [PATCH net-next v5 2/6] ipv6: ioam: Data plane support for Pre-allocated Trace Justin Iurman
2021-07-21 16:46 ` Eric Dumazet [this message]
2021-07-21 17:07 ` Justin Iurman
2021-07-22 2:47 ` David Ahern
2021-07-22 18:06 ` Justin Iurman
2021-07-20 19:42 ` [PATCH net-next v5 3/6] ipv6: ioam: IOAM Generic Netlink API Justin Iurman
2021-07-20 19:42 ` [PATCH net-next v5 4/6] ipv6: ioam: Support for IOAM injection with lwtunnels Justin Iurman
2021-07-20 19:43 ` [PATCH net-next v5 5/6] ipv6: ioam: Documentation for new IOAM sysctls Justin Iurman
2021-07-20 19:43 ` [PATCH net-next v5 6/6] selftests: net: Test for the IOAM insertion with IPv6 Justin Iurman
2021-07-22 2:52 ` David Ahern
2021-07-22 18:12 ` Justin Iurman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37f96841-39ad-c9bc-0b47-b1e418c4d9b8@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=justin.iurman@uliege.be \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).