* [B.A.T.M.A.N.] [PATCH next] batman-adv: fix alignment for batadv_tvlv_tt_change
@ 2013-12-15 12:26 Antonio Quartulli
2013-12-16 14:26 ` Marek Lindner
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-12-15 12:26 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
Make struct batadv_tvlv_tt_change 4 bytes long to avoid
padding on any architecture.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
packet.h | 4 ++--
translation-table.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/packet.h b/packet.h
index 04cf27c..2dd8f24 100644
--- a/packet.h
+++ b/packet.h
@@ -484,13 +484,13 @@ struct batadv_tvlv_tt_vlan_data {
* struct batadv_tvlv_tt_change - translation table diff data
* @flags: status indicators concerning the non-mesh client (see
* batadv_tt_client_flags)
- * @reserved: reserved field
+ * @reserved: reserved field - useful for alignment purposes only
* @addr: mac address of non-mesh client that triggered this tt change
* @vid: VLAN identifier
*/
struct batadv_tvlv_tt_change {
uint8_t flags;
- uint8_t reserved;
+ uint8_t reserved[3];
uint8_t addr[ETH_ALEN];
__be16 vid;
};
diff --git a/translation-table.c b/translation-table.c
index 4add57d..ff625fe 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -333,7 +333,8 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
return;
tt_change_node->change.flags = flags;
- tt_change_node->change.reserved = 0;
+ memset(tt_change_node->change.reserved, 0,
+ sizeof(tt_change_node->change.reserved));
memcpy(tt_change_node->change.addr, common->addr, ETH_ALEN);
tt_change_node->change.vid = htons(common->vid);
@@ -2221,7 +2222,8 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
ETH_ALEN);
tt_change->flags = tt_common_entry->flags;
tt_change->vid = htons(tt_common_entry->vid);
- tt_change->reserved = 0;
+ memset(tt_change->reserved, 0,
+ sizeof(tt_change->reserved));
tt_num_entries++;
tt_change++;
--
1.8.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH next] batman-adv: fix alignment for batadv_tvlv_tt_change
2013-12-15 12:26 [B.A.T.M.A.N.] [PATCH next] batman-adv: fix alignment for batadv_tvlv_tt_change Antonio Quartulli
@ 2013-12-16 14:26 ` Marek Lindner
0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-12-16 14:26 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On Sunday 15 December 2013 13:26:55 Antonio Quartulli wrote:
> Make struct batadv_tvlv_tt_change 4 bytes long to avoid
> padding on any architecture.
>
> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
> ---
> packet.h | 4 ++--
> translation-table.c | 6 ++++--
> 2 files changed, 6 insertions(+), 4 deletions(-)
Applied in revision 6639da5.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-16 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-15 12:26 [B.A.T.M.A.N.] [PATCH next] batman-adv: fix alignment for batadv_tvlv_tt_change Antonio Quartulli
2013-12-16 14:26 ` Marek Lindner
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).