diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-04-25 10:37:22 +0200 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-09 21:22:33 +0200 |
commit | 80067c8320aebab6d740e07be6ecf3dd04787f60 (patch) | |
tree | c2d81ee3d135fe6335d7ff765e85a4bb31128bcc /net/batman-adv/main.c | |
parent | 9f4980e68b4b72e6a4d7caadfacc54260d05ebf6 (diff) |
batman-adv: add build check macros for packet member offset
Since we removed the __packed from most of the packets, we should
make sure that the offset generated by the compiler are correct for
sent/received data.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/main.c')
-rw-r--r-- | net/batman-adv/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 43dc92e79a76..b22368e66895 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -393,6 +393,14 @@ static void batadv_recv_handler_init(void) for (i = 0; i < ARRAY_SIZE(batadv_rx_handler); i++) batadv_rx_handler[i] = batadv_recv_unhandled_packet; + /* compile time checks for struct member offsets */ + BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10); + BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4); + BUILD_BUG_ON(offsetof(struct batadv_unicast_frag_packet, dest) != 4); + BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4); + BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4); + BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4); + /* batman icmp packet */ batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet; /* unicast with 4 addresses packet */ |