--- batman-adv_master.packet.h 2012-11-08 00:15:01.787695585 +0100 +++ batctl_master.packet.h 2012-11-08 00:15:01.795695521 +0100 @@ -121,16 +121,13 @@ uint8_t magic[3]; /* FF:43:05 */ uint8_t type; /* bla_claimframe */ __be16 group; /* group id */ -}; +} __packed;
struct batadv_header { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t ttl; - /* the parent struct has to add a byte after the header to make - * everything 4 bytes aligned again - */ -}; +} __packed;
struct batadv_ogm_packet { struct batadv_header header; @@ -155,7 +152,7 @@ __be16 seqno; uint8_t uid; uint8_t reserved; -}; +} __packed;
#define BATADV_RR_LEN 16
@@ -171,28 +168,13 @@ uint8_t uid; uint8_t rr_cur; 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) +} __packed;
struct batadv_unicast_packet { struct batadv_header header; uint8_t ttvn; /* destination translation table version number */ uint8_t dest[ETH_ALEN]; - /* "4 bytes boundary + 2 bytes" long to make the payload after the - * following ethernet header again 4 bytes boundary aligned - */ -}; +} __packed;
/** * struct batadv_unicast_4addr_packet - extended unicast packet @@ -204,11 +186,7 @@ struct batadv_unicast_packet u; uint8_t src[ETH_ALEN]; uint8_t subtype; - uint8_t reserved; - /* "4 bytes boundary + 2 bytes" long to make the payload after the - * following ethernet header again 4 bytes boundary aligned - */ -}; +} __packed;
struct batadv_unicast_frag_packet { struct batadv_header header; @@ -225,12 +203,7 @@ uint8_t reserved; __be32 seqno; uint8_t orig[ETH_ALEN]; - /* "4 bytes boundary + 2 bytes" long to make the payload after the - * following ethernet header again 4 bytes boundary aligned - */ -}; - -#pragma pack() +} __packed;
struct batadv_vis_packet { struct batadv_header header; @@ -241,7 +214,7 @@ uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */ uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */ uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */ -}; +} __packed;
struct batadv_tt_query_packet { struct batadv_header header;
linux-merge@lists.open-mesh.org