From 5917e7d165d4a66d724631c196cf307485769821 Mon Sep 17 00:00:00 2001 From: Sergey Temerkhanov Date: Wed, 8 Apr 2015 01:41:22 -0500 Subject: net: Fix incorrect DHCP/BOOTP packets on 64-bit systems This commit fixes incorrect DHCP/BOOTP packet layout caused by 'ulong' type size difference on 64 and 32-bit architectures. It also renames NetReadLong()/NetCopyLong() to net_read_u32/net_copy_u32() accordingly. Signed-off-by: Radha Mohan Chintakuntla Signed-off-by: Sergey Temerkhanov Signed-off-by: Joe Hershberger Acked-by: Simon Glass --- include/net.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index 4488cc7d65..16fa117586 100644 --- a/include/net.h +++ b/include/net.h @@ -416,7 +416,7 @@ struct icmp_hdr { ushort id; ushort sequence; } echo; - ulong gateway; + u32 gateway; struct { ushort unused; ushort mtu; @@ -684,9 +684,9 @@ static inline struct in_addr net_read_ip(void *from) } /* return ulong *in network byteorder* */ -static inline ulong net_read_long(ulong *from) +static inline u32 net_read_u32(u32 *from) { - ulong l; + u32 l; memcpy((void *)&l, (void *)from, sizeof(l)); return l; @@ -705,9 +705,9 @@ static inline void net_copy_ip(void *to, void *from) } /* copy ulong */ -static inline void net_copy_long(ulong *to, ulong *from) +static inline void net_copy_u32(u32 *to, u32 *from) { - memcpy((void *)to, (void *)from, sizeof(ulong)); + memcpy((void *)to, (void *)from, sizeof(u32)); } /** -- cgit v1.2.3