From: Richard Cochran <richardcochran@gmail.com>
To: Eran Ben Elisha <eranbe@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Eric Dumazet <edumazet@google.com>, Jiri Pirko <jiri@nvidia.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Jakub Sitnicki <jakub@cloudflare.com>,
Guillaume Nault <gnault@redhat.com>, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next v3 2/2] net: flow_dissector: Parse PTP L2 packet header
Date: Tue, 12 Jan 2021 05:49:41 -0800 [thread overview]
Message-ID: <20210112134941.GA24407@hoboy.vegasvil.org> (raw)
In-Reply-To: <1610389068-2133-3-git-send-email-eranbe@nvidia.com>
On Mon, Jan 11, 2021 at 08:17:48PM +0200, Eran Ben Elisha wrote:
> Add support for parsing PTP L2 packet header. Such packet consists
> of an L2 header (with ethertype of ETH_P_1588), PTP header, body
> and an optional suffix.
>
> Signed-off-by: Eran Ben Elisha <eranbe@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> ---
> net/core/flow_dissector.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 6f1adba6695f..fcaa223c7cdc 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -23,6 +23,7 @@
> #include <linux/if_ether.h>
> #include <linux/mpls.h>
> #include <linux/tcp.h>
> +#include <linux/ptp_classify.h>
> #include <net/flow_dissector.h>
> #include <scsi/fc/fc_fcoe.h>
> #include <uapi/linux/batadv_packet.h>
> @@ -1251,6 +1252,21 @@ bool __skb_flow_dissect(const struct net *net,
> &proto, &nhoff, hlen, flags);
> break;
>
> + case htons(ETH_P_1588): {
> + struct ptp_header *hdr, _hdr;
> +
> + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data,
> + hlen, &_hdr);
> + if (!hdr || (hlen - nhoff) < sizeof(_hdr)) {
I'm not really familiar with the flow dissector, but why check (hlen - nhoff) here?
None of the other cases do that. Doesn't skb_copy_bits() in
__skb_header_pointer() already handle that?
Thanks,
Richard
> + fdret = FLOW_DISSECT_RET_OUT_BAD;
> + break;
> + }
> +
> + nhoff += ntohs(hdr->message_length);
> + fdret = FLOW_DISSECT_RET_OUT_GOOD;
> + break;
> + }
> +
> default:
> fdret = FLOW_DISSECT_RET_OUT_BAD;
> break;
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-01-12 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 18:17 [PATCH net-next v3 0/2] Dissect PTP L2 packet header Eran Ben Elisha
2021-01-11 18:17 ` [PATCH net-next v3 1/2] net: vlan: Add parse protocol header ops Eran Ben Elisha
2021-01-11 18:17 ` [PATCH net-next v3 2/2] net: flow_dissector: Parse PTP L2 packet header Eran Ben Elisha
2021-01-12 13:49 ` Richard Cochran [this message]
2021-01-12 14:16 ` Eran Ben Elisha
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=20210112134941.GA24407@hoboy.vegasvil.org \
--to=richardcochran@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eranbe@nvidia.com \
--cc=gnault@redhat.com \
--cc=jakub@cloudflare.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tariqt@nvidia.com \
--cc=vladimir.oltean@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.