]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/batman-adv/packet.h
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
[karo-tx-linux.git] / net / batman-adv / packet.h
index df548ed196d37e5f5e325cd0becfd4818f876b23..cb6405bf755cdbdf24b005b38416999e9ec38e19 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
-#define BATADV_ETH_P_BATMAN  0x4305 /* unofficial/not registered Ethertype */
-
 enum batadv_packettype {
        BATADV_IV_OGM           = 0x01,
        BATADV_ICMP             = 0x02,
@@ -173,6 +171,18 @@ struct batadv_icmp_packet_rr {
        uint8_t  rr[BATADV_RR_LEN][ETH_ALEN];
 };
 
+/* All packet headers in front of an ethernet header have to be completely
+ * divisible by 2 but not by 4 to make the payload after the ethernet
+ * header again 4 bytes boundary aligned.
+ *
+ * A packing of 2 is necessary to avoid extra padding at the end of the struct
+ * caused by a structure member which is larger than two bytes. Otherwise
+ * the structure would not fulfill the previously mentioned rule to avoid the
+ * 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 {
        struct batadv_header header;
        uint8_t  ttvn; /* destination translation table version number */
@@ -216,7 +226,9 @@ struct batadv_bcast_packet {
        /* "4 bytes boundary + 2 bytes" long to make the payload after the
         * following ethernet header again 4 bytes boundary aligned
         */
-} __packed;
+};
+
+#pragma pack()
 
 struct batadv_vis_packet {
        struct batadv_header header;