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 <[email protected]>
---
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

Reply via email to