Commit ea45cb0adcf4baa8f939fea4c848f3e1906f19d9

Authored by Matthias Weisser
Committed by Wolfgang Denk
1 parent 7f79c6f2f4

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: Matthias Weisser <weisserm@arcor.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>

Showing 4 changed files with 7 additions and 6 deletions Side-by-side Diff

... ... @@ -33,7 +33,8 @@
33 33  
34 34 #define PKTALIGN 32
35 35  
36   -typedef ulong IPaddr_t;
  36 +/* IPv4 addresses are always 32 bits in size */
  37 +typedef u32 IPaddr_t;
37 38  
38 39  
39 40 /**
... ... @@ -728,7 +728,7 @@
728 728 */
729 729 if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
730 730  
731   - debug("sending ARP for %08lx\n", dest);
  731 + debug("sending ARP for %08x\n", dest);
732 732  
733 733 NetArpWaitPacketIP = dest;
734 734 NetArpWaitPacketMAC = ether;
... ... @@ -751,7 +751,7 @@
751 751 return 1; /* waiting */
752 752 }
753 753  
754   - debug("sending UDP to %08lx/%pM\n", dest, ether);
  754 + debug("sending UDP to %08x/%pM\n", dest, ether);
755 755  
756 756 pkt = (uchar *)NetTxPacket;
757 757 pkt += NetSetEther(pkt, ether, PROT_IP);
... ... @@ -775,7 +775,7 @@
775 775  
776 776 memcpy(mac, NetEtherNullAddr, 6);
777 777  
778   - debug("sending ARP for %08lx\n", NetPingIP);
  778 + debug("sending ARP for %08x\n", NetPingIP);
779 779  
780 780 NetArpWaitPacketIP = NetPingIP;
781 781 NetArpWaitPacketMAC = mac;
... ... @@ -688,7 +688,7 @@
688 688 }
689 689  
690 690 if (BootFile[0] == '\0') {
691   - sprintf (default_filename, "/nfsroot/%02lX%02lX%02lX%02lX.img",
  691 + sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
692 692 NetOurIP & 0xFF,
693 693 (NetOurIP >> 8) & 0xFF,
694 694 (NetOurIP >> 16) & 0xFF,
... ... @@ -708,7 +708,7 @@
708 708  
709 709 TftpRemoteIP = NetServerIP;
710 710 if (BootFile[0] == '\0') {
711   - sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
  711 + sprintf(default_filename, "%02X%02X%02X%02X.img",
712 712 NetOurIP & 0xFF,
713 713 (NetOurIP >> 8) & 0xFF,
714 714 (NetOurIP >> 16) & 0xFF,