From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>,
Marek Lindner <lindner_marek@yahoo.de>,
Antonio Quartulli <antonio@meshcoding.com>
Subject: [PATCH 13/16] batman-adv: add build check macros for packet member offset
Date: Wed, 9 Oct 2013 21:32:51 +0200 [thread overview]
Message-ID: <1381347174-3629-14-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1381347174-3629-1-git-send-email-antonio@meshcoding.com>
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
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>
---
net/batman-adv/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 43dc92e..b22368e 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 */
--
1.8.3.2
next prev parent reply other threads:[~2013-10-09 19:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 19:32 pull request: batman-adv 2013-10-09b Antonio Quartulli
2013-10-09 19:32 ` [PATCH 01/16] MAINTAINERS: batman-adv - update emails Antonio Quartulli
2013-10-09 19:32 ` [PATCH 02/16] batman-adv: switch to a new packet compatibility version Antonio Quartulli
2013-10-09 19:32 ` [PATCH 03/16] batman-adv: tvlv - basic infrastructure Antonio Quartulli
2013-10-09 19:32 ` [PATCH 04/16] batman-adv: tvlv - gateway download/upload bandwidth container Antonio Quartulli
2013-10-09 19:32 ` [PATCH 05/16] batman-adv: tvlv - add distributed arp table container Antonio Quartulli
2013-10-09 19:32 ` [PATCH 06/16] batman-adv: tvlv - add network coding container Antonio Quartulli
2013-10-09 19:32 ` [PATCH 07/16] batman-adv: tvlv - convert tt data sent within OGMs Antonio Quartulli
2013-10-09 19:32 ` [PATCH 08/16] batman-adv: tvlv - convert tt query packet to use tvlv unicast packets Antonio Quartulli
2013-10-09 19:32 ` [PATCH 09/16] batman-adv: tvlv - convert roaming adv " Antonio Quartulli
2013-10-09 19:32 ` [PATCH 10/16] batman-adv: use CRC32C instead of CRC16 in TT code Antonio Quartulli
2013-10-09 19:32 ` [PATCH 11/16] batman-adv: move BATADV_TT_CLIENT_TEMP to higher bit Antonio Quartulli
2013-10-09 19:32 ` [PATCH 12/16] batman-adv: remove vis functionality Antonio Quartulli
2013-10-09 19:32 ` Antonio Quartulli [this message]
[not found] ` <1381347174-3629-14-git-send-email-antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
2013-10-10 8:37 ` [PATCH 13/16] batman-adv: add build check macros for packet member offset David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B7387-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2013-10-10 8:55 ` Antonio Quartulli
2013-10-09 19:32 ` [PATCH 14/16] batman-adv: reorder packet types Antonio Quartulli
2013-10-09 19:32 ` [PATCH 15/16] batman-adv: remove packed from batadv_ogm_packet Antonio Quartulli
2013-10-09 19:32 ` [PATCH 16/16] batman-adv: reorder batadv_iv_flags Antonio Quartulli
2013-10-09 19:56 ` pull request: batman-adv 2013-10-09b David Miller
2013-10-11 6:10 ` Antonio Quartulli
[not found] ` <20131011061053.GF576-rVWd3aGhH2zPj3vggD0kEA@public.gmane.org>
2013-10-11 20:45 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-10-09 12:40 pull request: batman-adv 2013-10-09 Antonio Quartulli
2013-10-09 12:40 ` [PATCH 13/16] batman-adv: add build check macros for packet member offset Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381347174-3629-14-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=lindner_marek@yahoo.de \
--cc=netdev@vger.kernel.org \
--cc=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=siwu@hrz.tu-chemnitz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).