aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/cmd_pxecfg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/cmd_pxecfg.c b/common/cmd_pxecfg.c
index 694a212ee..84b0d2507 100644
--- a/common/cmd_pxecfg.c
+++ b/common/cmd_pxecfg.c
@@ -55,12 +55,17 @@ static void format_mac_pxecfg(char **outbuf)
if (!ethaddr)
return;
- *outbuf = strdup(ethaddr);
+ /* "01-" MAC type prefix, dash-separated MAC address, zero */
+ *outbuf = malloc(3 + strlen(ethaddr) + 1);
if (*outbuf == NULL)
return;
- for (p = *outbuf; *p; p++) {
+ /* MAC type 1; ideally should be read from the DHCP/BOOTP reply packet,
+ * but in practice always 1 for Ethernet */
+ sprintf(*outbuf, "01-%s", ethaddr);
+
+ for (p = *outbuf + 3; *p; p++) {
if (*p == ':')
*p = '-';
}