diff mbox series

tipc: fix issue that tipc_dest neglects of big-endian

Message ID 1534760761-30206-1-git-send-email-Haiqing.Bai@windriver.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series tipc: fix issue that tipc_dest neglects of big-endian | expand

Commit Message

Bai, Haiqing Aug. 20, 2018, 10:26 a.m. UTC
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@windriver.com>
Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
---
 net/tipc/name_table.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

David Miller Aug. 21, 2018, 2:20 a.m. UTC | #1
From: Haiqing Bai <Haiqing.Bai@windriver.com>
Date: Mon, 20 Aug 2018 18:26:01 +0800

> 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@windriver.com>
> Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>

Jon and Ying, please review.

thank you.
Jon Maloy Aug. 21, 2018, 9:52 a.m. UTC | #2
Hi David, 
Please hold this one for now. 

///jon

> -----Original Message-----
> From: David Miller <davem@davemloft.net>
> Sent: Monday, 20 August, 2018 22:21
> To: Haiqing.Bai@windriver.com
> Cc: Jon Maloy <jon.maloy@ericsson.com>; ying.xue@windriver.com; zhenbo.gao@windriver.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] tipc: fix issue that tipc_dest neglects of big-endian
> 
> From: Haiqing Bai <Haiqing.Bai@windriver.com>
> Date: Mon, 20 Aug 2018 18:26:01 +0800
> 
> > 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@windriver.com>
> > Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
> 
> Jon and Ying, please review.
> 
> thank you.
Ying Xue Aug. 21, 2018, 9:57 a.m. UTC | #3
Sorry, I am on vacation too. I agree with Jon. Please temporarily hold this patch. Once I am back, I will review it as soon as possible.

Sent from my iPhone

> On Aug 21, 2018, at 9:52 PM, Jon Maloy <jon.maloy@ericsson.com> wrote:
> 
> Hi David, 
> Please hold this one for now. 
> 
> ///jon
> 
>> -----Original Message-----
>> From: David Miller <davem@davemloft.net>
>> Sent: Monday, 20 August, 2018 22:21
>> To: Haiqing.Bai@windriver.com
>> Cc: Jon Maloy <jon.maloy@ericsson.com>; ying.xue@windriver.com; zhenbo.gao@windriver.com; netdev@vger.kernel.org; linux-
>> kernel@vger.kernel.org
>> Subject: Re: [PATCH] tipc: fix issue that tipc_dest neglects of big-endian
>> 
>> From: Haiqing Bai <Haiqing.Bai@windriver.com>
>> Date: Mon, 20 Aug 2018 18:26:01 +0800
>> 
>>> 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@windriver.com>
>>> Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
>> 
>> Jon and Ying, please review.
>> 
>> thank you.
diff mbox series

Patch

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;
 	};