summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2021-01-21 21:40:36 +0100
committerJakub Kicinski <kuba@kernel.org>2021-01-23 12:34:20 -0800
commitdc090de854b9d7fdbc6f4df70bd7fc1b43eeccf8 (patch)
tree45e9fbe9ba0fc29acb14ede27838c1b148909d45 /include
parent0607a2cddb60f4548b55e28ac56a8d73493a45bb (diff)
net: mrp: fix definitions of MRP test packets
Wireshark says that the MRP test packets cannot be decoded - and the reason for that is that there's a two-byte hole filled with garbage between the "transitions" and "timestamp" members. So Wireshark decodes the two garbage bytes and the top two bytes of the timestamp written by the kernel as the timestamp value (which thus fluctuates wildly), and interprets the lower two bytes of the timestamp as a new (type, length) pair, which is of course broken. Even though this makes the timestamp field in the struct unaligned, it actually makes it end up on a 32 bit boundary in the frame as mandated by the standard, since it is preceded by a two byte TLV header. The struct definitions live under include/uapi/, but they are not really part of any kernel<->userspace API/ABI, so fixing the definitions by adding the packed attribute should not cause any compatibility issues. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/mrp_bridge.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h
index 9744773de5ff..5ce771327e32 100644
--- a/include/uapi/linux/mrp_bridge.h
+++ b/include/uapi/linux/mrp_bridge.h
@@ -97,7 +97,7 @@ struct br_mrp_ring_test_hdr {
__be16 state;
__be16 transitions;
__be32 timestamp;
-};
+} __attribute__((__packed__));
struct br_mrp_ring_topo_hdr {
__be16 prio;
@@ -142,7 +142,7 @@ struct br_mrp_in_test_hdr {
__be16 state;
__be16 transitions;
__be32 timestamp;
-};
+} __attribute__((__packed__));
struct br_mrp_in_topo_hdr {
__u8 sa[ETH_ALEN];