Skip to contentSkip to conversation

net/rarp.c missing htons() calls

PATCH New Marc Singer 1 participant 1 message May 29, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/rarp.c missing htons() calls

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

CHANGELOG +3 -0
diff -u -r1.2 CHANGELOG
@@ -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

rarp.c +3 -3
diff -u -r1.1.1.1 rarp.c
@@ -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 ??*/