PXE boot requests non-standard config filename
Bug #827705 reported by
Dave Walker
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro U-Boot |
Fix Released
|
Undecided
|
Loïc Minier | ||
u-boot |
Invalid
|
Undecided
|
Unassigned | ||
u-boot (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
u-boot-linaro (Ubuntu) |
Fix Released
|
Medium
|
John Rigby |
Bug Description
u-boot attempts to grab 88-99-aa-bb-cc-dd rather than 01-88-99-
"search for the config file using the hardware type (using its ARP type code) and address, all in lower case hexadecimal with dash separators; for example, for an Ethernet (ARP type 1) with address 88:99:AA:BB:CC:DD it would search for the filename 01-88-99-
Seems to be a simple change to format_mac_pxecfg() in common/cmd_pxecfg.c
Thanks.
Related branches
tags: | added: server-o-ro |
Changed in u-boot-linaro (Ubuntu): | |
assignee: | nobody → John Rigby (jcrigby) |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in u-boot-linaro: | |
status: | New → Confirmed |
assignee: | nobody → John Rigby (jcrigby) |
tags: | added: patch |
Changed in u-boot-linaro: | |
assignee: | John Rigby (jcrigby) → Loïc Minier (lool) |
status: | Confirmed → Fix Committed |
Changed in u-boot-linaro (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in u-boot-linaro: | |
status: | Fix Committed → Fix Released |
Changed in u-boot (Ubuntu): | |
status: | New → Invalid |
Changed in u-boot: | |
status: | New → Invalid |
To post a comment you must log in.
I had a look at what the spec says and what pxelinux and u-boot-linaro do in practice.
== pxelinux ==
Looking at pxelinux 4.04 as found in Ubuntu oneiric syslinux source package version 2:4.04+ dfsg-1ubuntu1.
syslinux/ core/fs/ pxe/pxe. c:network_ init() calls into the PXE ROM to get the DHCPACK packet with pxe_get_ cached_ info(2) (2 is BOOTP_REPLY according to the PXE spec and I confirmed this with a wire capture which shows 0x02 as the first byte of the BOOTP packet/UDP payload); the MAC type is then derived from the struct bootp_t hardware field and is always 1 for Ethernet (0x01 as the second byte of the BOOTP packet / UDP payload) and finally the actual MAC address is read from the macaddr field.
For completeness, syslinux/ core/fs/ pxe/pxe. h defines a bootp packet as follow:
struct bootp_t {
uint8_t opcode; /* BOOTP/DHCP "opcode" */
uint8_t hardware; /* ARP hreadware type */
[...]
uint8_t macaddr[16]; /* Client MAC address */
In syslinux/ core/fs/ pxe/pxe. c:make_ bootif_ string( ), the BOOTIF string is constructed as follows by pxelinux:
dst += sprintf(dst, "BOOTIF=%02x", MAC_type);
src = MAC;
for (i = MAC_len; i; i--)
dst += sprintf(dst, "-%02x", *src++);
and MAC_str just points at BOOTIFStr+7 (skipping "BOOTIF=")
Finally, pxe_load_config() in pxe.c attempts loading the following files:
* the DHCP provided filename
* pxelinux.cfg/ + UUID (if set in a DHCP option of the reply)
* pxelinux.cfg/ + MAC_str (MAC type and MAC address bytes in hexa separated by dashes)
* pxelinux.cfg/ + IP based strings (IP in hex without separators, getting shorter and shorter and less specific)
* pxelinux.cfg/ + "default"
== u-boot-linaro ==
Looking at u-boot- linaro- stable 605c08e8b6f7b7e 4b9d17b6cb367fb 27ce1c511c.
u-boot- linaro/ common/ cmd_pxecfg. c:get_pxecfg( ) tries:
* pxelinux.cfg/ + UUID (set in pxeuuid u-boot env)
* pxelinux.cfg/ + MAC address; the MAC address is looked for in the format_mac_pxecfg() function which tries the ethaddr u-boot env and falls back to usbethaddr, then converts all colons to dashes
* pxelinux.cfg/ + IP based strings (identical results to pxelinux -- sprintf(ip_addr, "%08X", ntohl(NetOurIP)))
* pxelinux.cfg/ + "default"
However by default the bootp/dhcp commands will attempt to load the DHCP supplied filename, so that should result in a similar behavior to the pxelinux one.
The main differences in the u-boot implementation are:
* UUID is set by the config / end-user in u-boot env instead and sent in DHCP requests rather than coming from DHCP replies
* MAC address doesn't come from the packet but from the env
* MAC type prefix is missing, should be read from the DHCP/BOOTP reply
== Spec ==
What the Intel PXE spec says is that:
* UUID comes from SMBIOS tables
* UUID should be sent in the DHCP requests
* only the DHCP/BOOTP provided filenames should be tried, nothing more
* doesn't say anything about where the MAC address should be obtained from or using a MAC type; this is pxelinux specific
But in reality, pxelinux is split in two stages: pxelinux.0 and then the config file it downloads; what u-boot emulates is what stage 1 does to download the stage 2 config and f...