[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220831100715.GB18919@pc-4.home>
Date: Wed, 31 Aug 2022 12:07:15 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Wojciech Drewek <wojciech.drewek@...el.com>
Cc: netdev@...r.kernel.org, alexandr.lobakin@...el.com,
jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, marcin.szycik@...ux.intel.com,
michal.swiatkowski@...ux.intel.com, kurt@...utronix.de,
boris.sukholitko@...adcom.com, vladbu@...dia.com,
komachi.yoshiki@...il.com, paulb@...dia.com,
baowen.zheng@...igine.com, louis.peens@...igine.com,
simon.horman@...igine.com, pablo@...filter.org,
maksym.glubokiy@...ision.eu, intel-wired-lan@...ts.osuosl.org,
jchapman@...alix.com
Subject: Re: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
On Mon, Aug 29, 2022 at 11:44:09AM +0200, Wojciech Drewek wrote:
> Allow to dissect L2TPv3 specific field which is:
> - session ID (32 bits)
>
> L2TPv3 might be transported over IP or over UDP,
> this ipmplementation is only about L2TPv3 over IP.
> IP protocold carries L2TPv3 when ip_proto is
s/protocold/protocol/
> +static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
> + struct flow_dissector *flow_dissector,
> + void *target_container, const void *data,
> + int nhoff, int hlen)
> +{
> + struct flow_dissector_key_l2tpv3 *key_l2tpv3;
> + struct {
> + __be32 session_id;
> + } *hdr, _hdr;
> +
> + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> + if (!hdr)
> + return;
> +
> + if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> + return;
I'd find it more logical to test !dissector_uses_key() first, then call
__skb_header_pointer(). But that probably just a personnal preference.
In any case the code looks good to me.
Acked-by: Guillaume Nault <gnault@...hat.com>
Powered by blists - more mailing lists