diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-04-25 04:37:22 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-09 15:22:33 -0400 |
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) | |||
393 | for (i = 0; i < ARRAY_SIZE(batadv_rx_handler); i++) | 393 | for (i = 0; i < ARRAY_SIZE(batadv_rx_handler); i++) |
394 | batadv_rx_handler[i] = batadv_recv_unhandled_packet; | 394 | batadv_rx_handler[i] = batadv_recv_unhandled_packet; |
395 | 395 | ||
396 | /* compile time checks for struct member offsets */ | ||
397 | BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10); | ||
398 | BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4); | ||
399 | BUILD_BUG_ON(offsetof(struct batadv_unicast_frag_packet, dest) != 4); | ||
400 | BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4); | ||
401 | BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4); | ||
402 | BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4); | ||
403 | |||
396 | /* batman icmp packet */ | 404 | /* batman icmp packet */ |
397 | batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet; | 405 | batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet; |
398 | /* unicast with 4 addresses packet */ | 406 | /* unicast with 4 addresses packet */ |