[PATCH] tipc: fix issue that tipc_dest neglects of big-endian

From: Haiqing Bai
Date: Mon Aug 20 2018 - 06:55:01 EST


The tipc multicast demo in tipcutils fails to work on big-endian hardware.
The tipc multicast server can not receive the packets sent by the multicast
client for that the dest port is always zero after tipc_dest_pop, then it
is found that the struct tipc_dest fails to take big/little endian into
account.

Signed-off-by: Haiqing Bai <Haiqing.Bai@xxxxxxxxxxxxx>
Signed-off-by: Zhenbo Gao <zhenbo.gao@xxxxxxxxxxxxx>
---
net/tipc/name_table.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 0febba4..6e1e0ab 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -135,8 +135,13 @@ struct tipc_dest {
struct list_head list;
union {
struct {
+#ifdef __LITTLE_ENDIAN_BITFIELD
u32 port;
u32 node;
+#else /* __BIG_ENDIAN_BITFIELD */
+ u32 node;
+ u32 port;
+#endif
};
u64 value;
};
--
1.9.1