From b983784c667c6fa4915b4f5f3ceb839e52be7f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Wed, 17 Aug 2011 15:32:55 +0200 Subject: [PATCH] pxecfg: Prefix MAC-based requests with "01-" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- common/cmd_pxecfg.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/cmd_pxecfg.c b/common/cmd_pxecfg.c index 694a212..84b0d25 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 = '-'; } -- 1.7.5.4