From: Matthias Weisser <weisserm@arcor.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: Make sure IPaddr_t is 32 bits in size
Date: Fri, 2 Dec 2011 17:26:12 +0100 [thread overview]
Message-ID: <1322843172-20251-1-git-send-email-weisserm@arcor.de> (raw)
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. 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: Matthias Weisser <weisserm@arcor.de>
---
include/net.h | 2 +-
net/net.c | 6 +++---
net/nfs.c | 2 +-
net/tftp.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net.h b/include/net.h
index ad9afbf..9d878e5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -33,7 +33,7 @@
#define PKTALIGN 32
-typedef ulong IPaddr_t;
+typedef u32 IPaddr_t;
/**
diff --git a/net/net.c b/net/net.c
index d0fe1c4..045405b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -728,7 +728,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
*/
if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
- debug("sending ARP for %08lx\n", dest);
+ debug("sending ARP for %08x\n", dest);
NetArpWaitPacketIP = dest;
NetArpWaitPacketMAC = ether;
@@ -751,7 +751,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
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 += NetSetEther(pkt, ether, PROT_IP);
@@ -775,7 +775,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6);
- debug("sending ARP for %08lx\n", NetPingIP);
+ debug("sending ARP for %08x\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP;
NetArpWaitPacketMAC = mac;
diff --git a/net/nfs.c b/net/nfs.c
index 5e717e3..b5b482c 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -688,7 +688,7 @@ NfsStart (void)
}
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 >> 8) & 0xFF,
(NetOurIP >> 16) & 0xFF,
diff --git a/net/tftp.c b/net/tftp.c
index 4999707..7aa3e23 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -708,7 +708,7 @@ void TftpStart(enum proto_t protocol)
TftpRemoteIP = NetServerIP;
if (BootFile[0] == '\0') {
- sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
+ sprintf(default_filename, "%02X%02X%02X%02X.img",
NetOurIP & 0xFF,
(NetOurIP >> 8) & 0xFF,
(NetOurIP >> 16) & 0xFF,
--
1.7.5.4
next reply other threads:[~2011-12-02 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 16:26 Matthias Weisser [this message]
2011-12-02 16:47 ` [U-Boot] [PATCH] net: Make sure IPaddr_t is 32 bits in size Mike Frysinger
2011-12-02 16:48 ` Mike Frysinger
2011-12-03 13:29 ` [U-Boot] [PATCH V2] " Matthias Weisser
2011-12-06 21:15 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322843172-20251-1-git-send-email-weisserm@arcor.de \
--to=weisserm@arcor.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.