[U-Boot-Users] [PATCH] net/rarp.c missing htons() calls

Marc Singer elf at buici.com
Thu May 29 23:12:38 CEST 2003


Rarp doesn't work on the little-endian IA32 without calling htons()
when composing the RARP packet.

-------------- next part --------------
Index: CHANGELOG
===================================================================
RCS file: /usr/src/repository/sf/u-boot/CHANGELOG,v
retrieving revision 1.2
diff -u -r1.2 CHANGELOG
--- CHANGELOG	29 May 2003 06:11:51 -0000	1.2
+++ CHANGELOG	29 May 2003 21:10:40 -0000
@@ -2,6 +2,9 @@
 Changes since U-Boot 0.3.1:
 ======================================================================
 
+* Patch by Marc Singer, 29 May 2003:
+  Fixed rarp boot method for IA32 and other little-endian CPUs.
+
 * Patch by Marc Singer, 28 May 2003:
   Added port I/O commands.
 
Index: net/rarp.c
===================================================================
RCS file: /usr/src/repository/sf/u-boot/net/rarp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rarp.c
--- net/rarp.c	23 May 2003 00:20:46 -0000	1.1.1.1
+++ net/rarp.c	29 May 2003 21:11:35 -0000
@@ -84,11 +84,11 @@
 
 	rarp = (ARP_t *)pkt;
 
-	rarp->ar_hrd = ARP_ETHER;
-	rarp->ar_pro = PROT_IP;
+	rarp->ar_hrd = htons (ARP_ETHER);
+	rarp->ar_pro = htons (PROT_IP);
 	rarp->ar_hln = 6;
 	rarp->ar_pln = 4;
-	rarp->ar_op  = RARPOP_REQUEST;
+	rarp->ar_op  = htons (RARPOP_REQUEST);
 	memcpy (&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
 	memcpy (&rarp->ar_data[6],  &NetOurIP,   4);	/* source IP addr */
 	memcpy (&rarp->ar_data[10], NetOurEther, 6);	/* dest ET addr = source ET addr ??*/


More information about the U-Boot mailing list