]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - net/bootp.c
status_led: Kconfig migration
[people/ms/u-boot.git] / net / bootp.c
index d718e35b63ec392e1f9d2df0cf1489df0e000d01..be8f710e0c5ca9bb0a2a884891932966c86d21c6 100644 (file)
@@ -15,7 +15,7 @@
 #include <net/tftp.h>
 #include "bootp.h"
 #include "nfs.h"
-#ifdef CONFIG_STATUS_LED
+#ifdef CONFIG_LED_STATUS
 #include <status_led.h>
 #endif
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
@@ -359,8 +359,8 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
        /*
         *      Got a good BOOTP reply.  Copy the data into our variables.
         */
-#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
-       status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
+#if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
+       status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_OFF);
 #endif
 
        store_net_params(bp);           /* Store net parameters from reply */
@@ -413,12 +413,21 @@ static void bootp_timeout_handler(void)
 
 static u8 *add_vci(u8 *e)
 {
+       char *vci = NULL;
+       char *env_vci = getenv("bootp_vci");
+
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
-       put_vci(e, CONFIG_SPL_NET_VCI_STRING);
+       vci = CONFIG_SPL_NET_VCI_STRING;
 #elif defined(CONFIG_BOOTP_VCI_STRING)
-       put_vci(e, CONFIG_BOOTP_VCI_STRING);
+       vci = CONFIG_BOOTP_VCI_STRING;
 #endif
 
+       if (env_vci)
+               vci = env_vci;
+
+       if (vci)
+               put_vci(e, vci);
+
        return e;
 }
 
@@ -431,10 +440,10 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 {
        u8 *start = e;
        u8 *cnt;
-#if defined(CONFIG_BOOTP_PXE)
+#ifdef CONFIG_LIB_UUID
        char *uuid;
-       u16 clientarch;
 #endif
+       int clientarch = -1;
 
 #if defined(CONFIG_BOOTP_VENDOREX)
        u8 *x;
@@ -490,12 +499,19 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
        }
 #endif
 
-#if defined(CONFIG_BOOTP_PXE)
+#ifdef CONFIG_BOOTP_PXE_CLIENTARCH
        clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
-       *e++ = 93;      /* Client System Architecture */
-       *e++ = 2;
-       *e++ = (clientarch >> 8) & 0xff;
-       *e++ = clientarch & 0xff;
+#endif
+
+       if (getenv("bootp_arch"))
+               clientarch = getenv_ulong("bootp_arch", 16, clientarch);
+
+       if (clientarch > 0) {
+               *e++ = 93;      /* Client System Architecture */
+               *e++ = 2;
+               *e++ = (clientarch >> 8) & 0xff;
+               *e++ = clientarch & 0xff;
+       }
 
        *e++ = 94;      /* Client Network Interface Identifier */
        *e++ = 3;
@@ -503,6 +519,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
        *e++ = 0;       /* major revision */
        *e++ = 0;       /* minor revision */
 
+#ifdef CONFIG_LIB_UUID
        uuid = getenv("pxeuuid");
 
        if (uuid) {
@@ -656,6 +673,15 @@ static int bootp_extended(u8 *e)
 
        *e++ = 255;             /* End of the list */
 
+       /*
+        * If nothing in list, remove it altogether. Some DHCP servers get
+        * upset by this minor faux pas and do not respond at all.
+        */
+       if (e == start + 3) {
+               printf("*** Warning: no DHCP options requested\n");
+               e -= 3;
+       }
+
        return e - start;
 }
 #endif