Commit 4f1cc51f authored by Eran Ben Elisha's avatar Eran Ben Elisha Committed by Jakub Kicinski

net: flow_dissector: Parse PTP L2 packet header

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: default avatarEran Ben Elisha <eranbe@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 71854255
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/mpls.h> #include <linux/mpls.h>
#include <linux/tcp.h> #include <linux/tcp.h>
#include <linux/ptp_classify.h>
#include <net/flow_dissector.h> #include <net/flow_dissector.h>
#include <scsi/fc/fc_fcoe.h> #include <scsi/fc/fc_fcoe.h>
#include <uapi/linux/batadv_packet.h> #include <uapi/linux/batadv_packet.h>
...@@ -1251,6 +1252,21 @@ bool __skb_flow_dissect(const struct net *net, ...@@ -1251,6 +1252,21 @@ bool __skb_flow_dissect(const struct net *net,
&proto, &nhoff, hlen, flags); &proto, &nhoff, hlen, flags);
break; break;
case htons(ETH_P_1588): {
struct ptp_header *hdr, _hdr;
hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data,
hlen, &_hdr);
if (!hdr) {
fdret = FLOW_DISSECT_RET_OUT_BAD;
break;
}
nhoff += ntohs(hdr->message_length);
fdret = FLOW_DISSECT_RET_OUT_GOOD;
break;
}
default: default:
fdret = FLOW_DISSECT_RET_OUT_BAD; fdret = FLOW_DISSECT_RET_OUT_BAD;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment