netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Wojciech Drewek <wojciech.drewek@intel.com>
Cc: netdev@vger.kernel.org, alexandr.lobakin@intel.com,
	jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, marcin.szycik@linux.intel.com,
	michal.swiatkowski@linux.intel.com, kurt@linutronix.de,
	boris.sukholitko@broadcom.com, vladbu@nvidia.com,
	komachi.yoshiki@gmail.com, paulb@nvidia.com,
	baowen.zheng@corigine.com, louis.peens@corigine.com,
	simon.horman@corigine.com, pablo@netfilter.org,
	maksym.glubokiy@plvision.eu, intel-wired-lan@lists.osuosl.org,
	jchapman@katalix.com
Subject: Re: [RFC PATCH net-next v3 2/5] flow_dissector: Add L2TPv3 dissectors
Date: Thu, 1 Sep 2022 14:35:27 +0200	[thread overview]
Message-ID: <20220901123527.GA3398@debian.home> (raw)
In-Reply-To: <20220901120131.1373568-3-wojciech.drewek@intel.com>

On Thu, Sep 01, 2022 at 02:01:28PM +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

Nit: you didn't fix the spelling of "protocold". It's probably not
worth to send a new version just because of this typo though.

> Acked-by: Guillaume Nault <gnault@redhat.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
> ---
> v3: move !dissector_uses_key() check before calling
>     __skb_header_pointer
> ---
>  include/net/flow_dissector.h |  9 +++++++++
>  net/core/flow_dissector.c    | 28 ++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
> index 6c74812d64b2..5ccf52ef8809 100644
> --- a/include/net/flow_dissector.h
> +++ b/include/net/flow_dissector.h
> @@ -289,6 +289,14 @@ struct flow_dissector_key_pppoe {
>  	__be16 type;
>  };
>  
> +/**
> + * struct flow_dissector_key_l2tpv3:
> + * @session_id: identifier for a l2tp session
> + */
> +struct flow_dissector_key_l2tpv3 {
> +	__be32 session_id;
> +};
> +
>  enum flow_dissector_key_id {
>  	FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
>  	FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
> @@ -320,6 +328,7 @@ enum flow_dissector_key_id {
>  	FLOW_DISSECTOR_KEY_HASH, /* struct flow_dissector_key_hash */
>  	FLOW_DISSECTOR_KEY_NUM_OF_VLANS, /* struct flow_dissector_key_num_of_vlans */
>  	FLOW_DISSECTOR_KEY_PPPOE, /* struct flow_dissector_key_pppoe */
> +	FLOW_DISSECTOR_KEY_L2TPV3, /* struct flow_dissector_key_l2tpv3 */
>  
>  	FLOW_DISSECTOR_KEY_MAX,
>  };
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 764c4cb3fe8f..8180e65ab8e2 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -204,6 +204,30 @@ static void __skb_flow_dissect_icmp(const struct sk_buff *skb,
>  	skb_flow_get_icmp_tci(skb, key_icmp, data, thoff, hlen);
>  }
>  
> +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;
> +
> +	if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> +		return;
> +
> +	hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> +	if (!hdr)
> +		return;
> +
> +	key_l2tpv3 = skb_flow_dissector_target(flow_dissector,
> +					       FLOW_DISSECTOR_KEY_L2TPV3,
> +					       target_container);
> +
> +	key_l2tpv3->session_id = hdr->session_id;
> +}
> +
>  void skb_flow_dissect_meta(const struct sk_buff *skb,
>  			   struct flow_dissector *flow_dissector,
>  			   void *target_container)
> @@ -1497,6 +1521,10 @@ bool __skb_flow_dissect(const struct net *net,
>  		__skb_flow_dissect_icmp(skb, flow_dissector, target_container,
>  					data, nhoff, hlen);
>  		break;
> +	case IPPROTO_L2TP:
> +		__skb_flow_dissect_l2tpv3(skb, flow_dissector, target_container,
> +					  data, nhoff, hlen);
> +		break;
>  
>  	default:
>  		break;
> -- 
> 2.31.1
> 


  reply	other threads:[~2022-09-01 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 12:01 [RFC PATCH net-next v3 0/5] ice: L2TPv3 offload support Wojciech Drewek
2022-09-01 12:01 ` [RFC PATCH net-next v3 1/5] uapi: move IPPROTO_L2TP to in.h Wojciech Drewek
2022-09-01 12:01 ` [RFC PATCH net-next v3 2/5] flow_dissector: Add L2TPv3 dissectors Wojciech Drewek
2022-09-01 12:35   ` Guillaume Nault [this message]
2022-09-01 12:58     ` Drewek, Wojciech
2022-09-01 12:01 ` [RFC PATCH net-next v3 3/5] net/sched: flower: Add L2TPv3 filter Wojciech Drewek
2022-09-01 12:01 ` [RFC PATCH net-next v3 4/5] flow_offload: Introduce flow_match_l2tpv3 Wojciech Drewek
2022-09-01 12:01 ` [RFC PATCH net-next v3 5/5] ice: Add L2TPv3 hardware offload support Wojciech Drewek

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=20220901123527.GA3398@debian.home \
    --to=gnault@redhat.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=baowen.zheng@corigine.com \
    --cc=boris.sukholitko@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jchapman@katalix.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=komachi.yoshiki@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=louis.peens@corigine.com \
    --cc=maksym.glubokiy@plvision.eu \
    --cc=marcin.szycik@linux.intel.com \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=paulb@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=vladbu@nvidia.com \
    --cc=wojciech.drewek@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /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).