aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Minier <loic.minier@linaro.org>2011-08-17 15:32:55 +0200
committerJohn Rigby <john.rigby@linaro.org>2011-08-17 08:49:17 -0600
commit8ed2c44f563f03ecfe0999dd475e51a574cd93e0 (patch)
treeabf236cae74bddadbfb35fe7c5a4a5754dec26c4
parenta58e8d4f602f7024d6ae464febbfc479f9f64e59 (diff)
pxecfg: Prefix MAC-based requests with "01-"2011.08.1
pxelinux will prefix per MAC-address requests with the MAC type prefix which is "01-" for Ethernet, so do this in pxecfg as well. Cc: patches@linaro.org Signed-off-by: Loïc Minier <loic.minier@linaro.org>
-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 = '-';
}