aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bootp.c23
-rw-r--r--src/bootp.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/bootp.c b/src/bootp.c
index 1a3517e..3ade02c 100644
--- a/src/bootp.c
+++ b/src/bootp.c
@@ -34,6 +34,8 @@
#define LEASE_TIME (24 * 3600)
+#define UEFI_HTTP_VENDOR_CLASS_ID "HTTPClient"
+
static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
#define DPRINTF(fmt, ...) DEBUG_CALL(fmt, ##__VA_ARGS__)
@@ -340,6 +342,27 @@ static void bootp_reply(Slirp *slirp,
q += val;
}
}
+
+ /* this allows to support UEFI HTTP boot: according to the UEFI
+ specification, DHCP server must send vendor class identifier option
+ set to "HTTPClient" string, when responding to DHCP requests as part
+ of the UEFI HTTP boot
+
+ we assume that, if the bootfile parameter was configured as an http
+ URL, the user intends to perform UEFI HTTP boot, so send this option
+ automatically */
+ if (g_str_has_prefix(slirp->bootp_filename, "http://")) {
+ val = strlen(UEFI_HTTP_VENDOR_CLASS_ID);
+ if (q + val + 2 >= end) {
+ g_warning("DHCP packet size exceeded, "
+ "omitting vendor class id option.");
+ } else {
+ *q++ = RFC2132_VENDOR_CLASS_ID;
+ *q++ = val;
+ memcpy(q, UEFI_HTTP_VENDOR_CLASS_ID, val);
+ q += val;
+ }
+ }
} else {
static const char nak_msg[] = "requested address not available";
diff --git a/src/bootp.h b/src/bootp.h
index 31ce5fd..cf7797f 100644
--- a/src/bootp.h
+++ b/src/bootp.h
@@ -71,6 +71,7 @@
#define RFC2132_MAX_SIZE 57
#define RFC2132_RENEWAL_TIME 58
#define RFC2132_REBIND_TIME 59
+#define RFC2132_VENDOR_CLASS_ID 60
#define RFC2132_TFTP_SERVER_NAME 66
#define DHCPDISCOVER 1