aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Hobbs <jason.hobbs@calxeda.com>2011-05-12 14:40:40 -0500
committerJohn Rigby <john.rigby@linaro.org>2011-06-28 16:23:00 +0100
commit2a60827f5f2f806546f69f16e4f9fc84b6dbf4d0 (patch)
treeb6217640b060898bf1cf3b86863ca847163ad0c5
parent281fd46c16d0761aec7fb889e2b0ef810b9e1635 (diff)
net: bootp: add PXE/RFC 4578 DHCP options support
These options are required to be present in RFC 4578 compliant DHCP requests. They give more information to DHCP servers to allow serving different DHCP responses to different systems based on client architecture, client capabilities, UUID, or vendor. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
-rw-r--r--net/bootp.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 4db63cbbe..7748f58e5 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -14,6 +14,7 @@
#include "bootp.h"
#include "tftp.h"
#include "nfs.h"
+#include "uuid.h"
#ifdef CONFIG_STATUS_LED
#include <status_led.h>
#endif
@@ -360,6 +361,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;
@@ -414,6 +420,37 @@ 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) {
+ *e++ = 97; /* Client Machine Identifier */
+ *e++ = 17;
+ *e++ = 0; /* type 0 - UUID */
+
+ uuid_str_to_bin(uuid, e);
+ e += 16;
+ }
+
+ *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;