Noticed difference in batadv_packet.h in master.diff

postmaster at open-mesh.org postmaster at open-mesh.org
Tue Mar 6 00:05:02 CET 2018


--- batman-adv_master.packet.h	2018-03-06 00:05:02.030715108 +0100
+++ batctl_master.packet.h	2018-03-06 00:05:02.038714932 +0100
@@ -196,6 +196,8 @@
 	__be16 group;		/* group id */
 };
 
+#pragma pack()
+
 /**
  * struct batadv_ogm_packet - ogm (routing protocol) packet
  * @packet_type: batman-adv packet type, part of the general header
@@ -220,6 +222,9 @@
 	__u8   reserved;
 	__u8   tq;
 	__be16 tvlv_len;
+	/* __packed is not needed as the struct size is divisible by 4,
+	 * and the largest data type in this struct has a size of 4.
+	 */
 };
 
 #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
@@ -244,6 +249,9 @@
 	__u8   orig[ETH_ALEN];
 	__be16 tvlv_len;
 	__be32 throughput;
+	/* __packed is not needed as the struct size is divisible by 4,
+	 * and the largest data type in this struct has a size of 4.
+	 */
 };
 
 #define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
@@ -397,6 +405,7 @@
  * misalignment of the payload after the ethernet header. It may also lead to
  * leakage of information when the padding it not initialized before sending.
  */
+#pragma pack(2)
 
 /**
  * struct batadv_unicast_packet - unicast packet for network payload
@@ -524,6 +533,8 @@
 	__be16 coded_len;
 };
 
+#pragma pack()
+
 /**
  * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload
  * @packet_type: batman-adv packet type, part of the general header
@@ -630,6 +641,4 @@
 	__u8 reserved[3];
 };
 
-#pragma pack()
-
 #endif /* _UAPI_LINUX_BATADV_PACKET_H_ */


More information about the linux-merge mailing list