]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/bootp.c
ppc4xx: Fix compilation breakage in miiphy.c
[karo-tx-uboot.git] / net / bootp.c
index 0799ae2b0fc4a4f9103d21e6bd73c9cc64df3a91..1a717867d48885b479050909b43d1cba0b372fe7 100644 (file)
@@ -20,8 +20,6 @@
 
 #define BOOTP_VENDOR_MAGIC     0x63825363      /* RFC1048 Magic Cookie         */
 
-#if defined(CONFIG_CMD_NET)
-
 #define TIMEOUT                5000UL  /* Milliseconds before trying BOOTP again */
 #ifndef CONFIG_NET_RETRY_COUNT
 # define TIMEOUT_COUNT 5               /* # of timeouts before giving up  */
@@ -458,6 +456,10 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
        *e++  = 42;
        *cnt += 1;
 #endif
+       /* no options, so back up to avoid sending an empty request list */
+       if (*cnt == 0)
+               e -= 2;
+
        *e++  = 255;            /* End of the list */
 
        /* Pad to minimal length */
@@ -683,6 +685,9 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
 {
        uchar *end = popt + BOOTP_HDR_SIZE;
        int oplen, size;
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
+       int *to_ptr;
+#endif
 
        while (popt < end && *popt != 0xff) {
                oplen = *(popt + 1);
@@ -692,7 +697,8 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
                        break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
                case 2:         /* Time offset  */
-                       NetCopyLong ((ulong *)&NetTimeOffset, (ulong *) (popt + 2));
+                       to_ptr = &NetTimeOffset;
+                       NetCopyLong ((ulong *)to_ptr, (ulong *)(popt + 2));
                        NetTimeOffset = ntohl (NetTimeOffset);
                        break;
 #endif
@@ -944,5 +950,3 @@ void DhcpRequest(void)
        BootpRequest();
 }
 #endif /* CONFIG_CMD_DHCP */
-
-#endif /* CONFIG_CMD_NET */