]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/bootp.c
net: bootp: add PXE/RFC 4578 DHCP options support
[karo-tx-uboot.git] / net / bootp.c
index 3db08ea2f31583443ee11581763bac4d1fccb2a8..73470f2d46fc66942b65e39a975be89e43329f4a 100644 (file)
@@ -164,8 +164,8 @@ static void auto_load(void)
                        return;
                }
 #endif
-       TftpStart();
        }
+       TftpStart();
 }
 
 #if !defined(CONFIG_CMD_DHCP)
@@ -381,6 +381,11 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
 {
        u8 *start = e;
        u8 *cnt;
+#if defined(CONFIG_BOOTP_PXE)
+       char *uuid;
+       size_t vci_strlen;
+       u16 clientarch;
+#endif
 
 #if defined(CONFIG_BOOTP_VENDOREX)
        u8 *x;
@@ -435,6 +440,41 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
        }
 #endif
 
+#if defined(CONFIG_BOOTP_PXE)
+       clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
+       *e++ = 93;      /* Client System Architecture */
+       *e++ = 2;
+       *e++ = (clientarch >> 8) & 0xff;
+       *e++ = clientarch & 0xff;
+
+       *e++ = 94;      /* Client Network Interface Identifier */
+       *e++ = 3;
+       *e++ = 1;       /* type field for UNDI */
+       *e++ = 0;       /* major revision */
+       *e++ = 0;       /* minor revision */
+
+       uuid = getenv("pxeuuid");
+
+       if (uuid) {
+               if (uuid_str_valid(uuid)) {
+                       *e++ = 97;      /* Client Machine Identifier */
+                       *e++ = 17;
+                       *e++ = 0;       /* type 0 - UUID */
+
+                       uuid_str_to_bin(uuid, e);
+                       e += 16;
+               } else {
+                       printf("Invalid pxeuuid: %s\n", uuid);
+               }
+       }
+
+       *e++ = 60;      /* Vendor Class Identifier */
+       vci_strlen = strlen(CONFIG_BOOTP_VCI_STRING);
+       *e++ = vci_strlen;
+       memcpy(e, CONFIG_BOOTP_VCI_STRING, vci_strlen);
+       e += vci_strlen;
+#endif
+
 #if defined(CONFIG_BOOTP_VENDOREX)
        if ((x = dhcp_vendorex_prep (e)))
                return x - start;