提交 ea45cb0a 编写于 作者: M Matthias Weisser 提交者: Wolfgang Denk

net: Make sure IPaddr_t is 32 bits in size

When building u-boot as 64 bit application (e.g. sandbox) ulong might be
64 bits in size. This breaks network code as IPaddr_t is 64 bytes in
size then and an IPv4 address is 32 bits in size. This patch makes sure
that IPaddr_t is always 32 bits in size. Also some warnings introduced
by this patch are fixed.
Signed-off-by: NMatthias Weisser <weisserm@arcor.de>
Acked-by: NMike Frysinger <vapier@gentoo.org>
上级 7f79c6f2
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#define PKTALIGN 32 #define PKTALIGN 32
typedef ulong IPaddr_t; /* IPv4 addresses are always 32 bits in size */
typedef u32 IPaddr_t;
/** /**
......
...@@ -728,7 +728,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) ...@@ -728,7 +728,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
*/ */
if (memcmp(ether, NetEtherNullAddr, 6) == 0) { if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
debug("sending ARP for %08lx\n", dest); debug("sending ARP for %08x\n", dest);
NetArpWaitPacketIP = dest; NetArpWaitPacketIP = dest;
NetArpWaitPacketMAC = ether; NetArpWaitPacketMAC = ether;
...@@ -751,7 +751,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) ...@@ -751,7 +751,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
return 1; /* waiting */ return 1; /* waiting */
} }
debug("sending UDP to %08lx/%pM\n", dest, ether); debug("sending UDP to %08x/%pM\n", dest, ether);
pkt = (uchar *)NetTxPacket; pkt = (uchar *)NetTxPacket;
pkt += NetSetEther(pkt, ether, PROT_IP); pkt += NetSetEther(pkt, ether, PROT_IP);
...@@ -775,7 +775,7 @@ int PingSend(void) ...@@ -775,7 +775,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6); memcpy(mac, NetEtherNullAddr, 6);
debug("sending ARP for %08lx\n", NetPingIP); debug("sending ARP for %08x\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP; NetArpWaitPacketIP = NetPingIP;
NetArpWaitPacketMAC = mac; NetArpWaitPacketMAC = mac;
......
...@@ -688,7 +688,7 @@ NfsStart (void) ...@@ -688,7 +688,7 @@ NfsStart (void)
} }
if (BootFile[0] == '\0') { if (BootFile[0] == '\0') {
sprintf (default_filename, "/nfsroot/%02lX%02lX%02lX%02lX.img", sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
NetOurIP & 0xFF, NetOurIP & 0xFF,
(NetOurIP >> 8) & 0xFF, (NetOurIP >> 8) & 0xFF,
(NetOurIP >> 16) & 0xFF, (NetOurIP >> 16) & 0xFF,
......
...@@ -708,7 +708,7 @@ void TftpStart(enum proto_t protocol) ...@@ -708,7 +708,7 @@ void TftpStart(enum proto_t protocol)
TftpRemoteIP = NetServerIP; TftpRemoteIP = NetServerIP;
if (BootFile[0] == '\0') { if (BootFile[0] == '\0') {
sprintf(default_filename, "%02lX%02lX%02lX%02lX.img", sprintf(default_filename, "%02X%02X%02X%02X.img",
NetOurIP & 0xFF, NetOurIP & 0xFF,
(NetOurIP >> 8) & 0xFF, (NetOurIP >> 8) & 0xFF,
(NetOurIP >> 16) & 0xFF, (NetOurIP >> 16) & 0xFF,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册