From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [RFC-alt 3/4] batman-adv: Fix alignment for payload after batadv_unicast_4addr_packet
Date: Mon, 5 Nov 2012 10:15:24 +0100 [thread overview]
Message-ID: <1352106924-6755-1-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1352038798-29658-3-git-send-email-sven@narfation.org>
batadv_unicast_4addr_packet created an odd aligned ethernet header and a not 4
bytes boundary aligned IP header. Adding an extra reserved bytes avoids this
problem.
This problem was introduced in 78fc6bbe0aca868b65b92723b1e259e7ef7b35c0
("batman-adv: add UNICAST_4ADDR packet type")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
This is an alternative version of the third patch.
DONT APPLY PATCH 4 WHEN NOT APPLYING THE INITIAL VERSION OF THE THIRD PATCH
packet.h | 6 +++++-
unicast.c | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/packet.h b/packet.h
index 43c863c..0a9886c 100644
--- a/packet.h
+++ b/packet.h
@@ -191,7 +191,11 @@ struct batadv_unicast_4addr_packet {
struct batadv_unicast_packet u;
uint8_t src[ETH_ALEN];
uint8_t subtype;
-} __packed;
+ uint8_t reserved;
+ /* "4 bytes boundary + 2 bytes" long to make the payload after the
+ * following ethernet header again 4 bytes boundary aligned
+ */
+};
struct batadv_unicast_frag_packet {
struct batadv_header header;
diff --git a/unicast.c b/unicast.c
index 9416136..10aff49 100644
--- a/unicast.c
+++ b/unicast.c
@@ -374,6 +374,7 @@ bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv,
memcpy(unicast_4addr_packet->src, primary_if->net_dev->dev_addr,
ETH_ALEN);
unicast_4addr_packet->subtype = packet_subtype;
+ unicast_4addr_packet->reserved = 0;
ret = true;
out:
--
1.7.10.4
next prev parent reply other threads:[~2012-11-05 9:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-04 14:19 [B.A.T.M.A.N.] [RFC 1/4] batman-adv: Align skb for better alignment Sven Eckelmann
2012-11-04 14:19 ` [B.A.T.M.A.N.] [RFC 2/4] batman-adv: Mark correctly aligned headers not as __packed Sven Eckelmann
2012-11-05 20:25 ` [B.A.T.M.A.N.] [RFC-alt1/2 " Sven Eckelmann
2012-11-05 20:25 ` [B.A.T.M.A.N.] [RFC-alt2/2 2/4] batman-adv: Use packing of 2 for all headers before an ethernet header Sven Eckelmann
2012-11-07 15:07 ` Marek Lindner
2012-11-07 14:56 ` [B.A.T.M.A.N.] [RFC-alt1/2 2/4] batman-adv: Mark correctly aligned headers not as __packed Marek Lindner
2012-11-04 14:19 ` [B.A.T.M.A.N.] [RFC 3/4] batman-adv: Fix alignment and padding of packets Sven Eckelmann
2012-11-05 9:15 ` Sven Eckelmann [this message]
2012-11-07 15:16 ` [B.A.T.M.A.N.] [RFC-alt 3/4] batman-adv: Fix alignment for payload after batadv_unicast_4addr_packet Marek Lindner
2012-11-04 14:19 ` [B.A.T.M.A.N.] [RFC 4/4] batman-adv: Use compare_ether_addr instead of private function Sven Eckelmann
2012-11-04 16:11 ` [B.A.T.M.A.N.] [RFCv2 1/4] batman-adv: Reserve extra bytes in skb for better alignment Sven Eckelmann
2012-11-07 14:44 ` Marek Lindner
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=1352106924-6755-1-git-send-email-sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/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