Re: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
From: Guillaume Nault <hidden>
Date: 2022-08-31 10:07:24
Also in:
intel-wired-lan
From: Guillaume Nault <hidden>
Date: 2022-08-31 10:07:24
Also in:
intel-wired-lan
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 <redacted>