]> git.sur5r.net Git - u-boot/blobdiff - net/bootp.c
[MIPS] Request for the 'mips_cache_lock()' removal
[u-boot] / net / bootp.c
index 80f53bc8863fd8fca4ec9305a896accdcb6b8cb3..89e30d2c703e2d8423b84c0e9844bee7041dd343 100644 (file)
@@ -33,7 +33,7 @@
 
 #if defined(CONFIG_CMD_NET)
 
-#define TIMEOUT                5               /* Seconds before trying BOOTP again    */
+#define TIMEOUT                5UL             /* Seconds before trying BOOTP again    */
 #ifndef CONFIG_NET_RETRY_COUNT
 # define TIMEOUT_COUNT 5               /* # of timeouts before giving up  */
 #else
@@ -120,10 +120,12 @@ static void BootpCopyNetParams(Bootp_t *bp)
        IPaddr_t tmp_ip;
 
        NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
+#if !defined(CONFIG_BOOTP_SERVERIP)
        NetCopyIP(&tmp_ip, &bp->bp_siaddr);
        if (tmp_ip != 0)
                NetCopyIP(&NetServerIP, &bp->bp_siaddr);
        memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6);
+#endif
        if (strlen(bp->bp_file) > 0)
                copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
 
@@ -728,7 +730,7 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
                        break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
                case 2:         /* Time offset  */
-                       NetCopyLong (&NetTimeOffset, (ulong *) (popt + 2));
+                       NetCopyLong ((ulong *)&NetTimeOffset, (ulong *) (popt + 2));
                        NetTimeOffset = ntohl (NetTimeOffset);
                        break;
 #endif
@@ -848,9 +850,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
        bp->bp_hlen = HWL_ETHER;
        bp->bp_hops = 0;
        bp->bp_secs = htons(get_timer(0) / CFG_HZ);
-       NetCopyIP(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */
-       NetCopyIP(&bp->bp_yiaddr, &bp_offer->bp_yiaddr);
-       NetCopyIP(&bp->bp_siaddr, &bp_offer->bp_siaddr);
+       /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by
+        * the server yet */
+
        /*
         * RFC3046 requires Relay Agents to discard packets with
         * nonzero and offered giaddr
@@ -868,7 +870,9 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
        /*
         * Copy options from OFFER packet if present
         */
-       NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
+
+       /* Copy offered IP into the parameters request list */
+       NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);
        extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
 
        pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
@@ -975,6 +979,6 @@ void DhcpRequest(void)
 {
        BootpRequest();
 }
-#endif
+#endif /* CONFIG_CMD_DHCP */
 
-#endif
+#endif /* CONFIG_CMD_NET */