Bug 1483740 - pxe booting with grubaa64.efi adds extra "-" to config filename
Summary: pxe booting with grubaa64.efi adds extra "-" to config filename
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grub2
Version: 7.4
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 7.5
Assignee: Peter Jones
QA Contact: Release Test Team
Petr Bokoc
URL:
Whiteboard:
: 1479496 1487107 (view as bug list)
Depends On:
Blocks: 1485496 1487106 1495216 1497323
TreeView+ depends on / blocked
 
Reported: 2017-08-21 20:23 UTC by Jeff Bastian
Modified: 2018-04-11 10:11 UTC (History)
13 users (show)

Fixed In Version: grub2-2.02-0.65.el7
Doc Type: Bug Fix
Doc Text:
A bug in the GRUB2 boot loader caused a trailing "-" character to be added to the client MAC address when attempting to load configuration files from a tftp server during PXE boot. This update fixes the bug, and clients can now load their GRUB2 configuration files from tftp servers successfully.
Clone Of:
: 1495216 1497323 (view as bug list)
Environment:
Last Closed: 2018-04-11 10:11:05 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1495216 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 1495216

Description Jeff Bastian 2017-08-21 20:23:24 UTC
Description of problem:
I configured a PXE server for 64-bit ARM clients, and the clients were failing to find their config files on the tftp server and just getting dropped to the "grub>" prompt.  I watched the network packets with Wireshark and noticed that there is an extra trailing "-" after the MAC address in the config filename:

Read Request, File: /pxegrub/grub.cfg-01-00-01-73-02-02-ea-
Read Request, File: /pxegrub/grub.cfg-0A0CD3F7
Read Request, File: /pxegrub/grub.cfg-0A0CD3F
Read Request, File: /pxegrub/grub.cfg-0A0CD3
Read Request, File: /pxegrub/grub.cfg-0A0CD
Read Request, File: /pxegrub/grub.cfg-0A0C
Read Request, File: /pxegrub/grub.cfg-0A0
Read Request, File: /pxegrub/grub.cfg-0A
Read Request, File: /pxegrub/grub.cfg-0
Read Request, File: /pxegrub/grub.cfg

Please remove the trailing "-" character from the first tftp request.


Version-Release number of selected component (if applicable):
grub2-efi-aa64-2.02-0.64.el7.aarch64.rpm

How reproducible:
always

Steps to Reproduce:
1. PXE boot a 64-bit ARM system
2. on the PXE server, watch the packets: 
     tshark -w tftp.pcap -i eth0 udp port 69

Actual results:
first tftp request appends a "-" char after the MAC address and the system fails to find its grub config file

Expected results:
no trailing "-"

Additional info:

Comment 1 Jeff Bastian 2017-08-21 20:51:26 UTC
I did some bisecting of grub versions and found the bug was introduced with grub2-efi-aa64-2.02-0.61.el7.aarch64.rpm

Comment 3 Mark Salter 2017-08-22 15:23:30 UTC
The problem was introduced in  0002-Add-support-for-non-Ethernet-network-cards.patch which added support for longer hw addresses.

This change:
+-#define GRUB_NET_MAX_STR_HWADDR_LEN (sizeof ("XX:XX:XX:XX:XX:XX"))
++#define GRUB_NET_MAX_STR_HWADDR_LEN (sizeof (\
++	"XX:XX:XX:XX:XX:XX:XX:XX:"\
++	"XX:XX:XX:XX:XX:XX:XX:XX:"\
++	"XX:XX:XX:XX:XX:XX:XX:XX:"\
++	"XX:XX:XX:XX:XX:XX:XX:XX"))

The way hwadd to str is done:

  for (ptr = str, i = 0; i < addr->len; i++)
    {
      ptr += grub_snprintf (ptr, GRUB_NET_MAX_STR_HWADDR_LEN - (ptr - str),
		     "%02x:", addr->mac[i] & 0xff);
    }

GRUB_NET_MAX_STR_HWADDR_LEN was preventing a ':' at the end of the string for ethernet. But now with bigger GRUB_NET_MAX_STR_HWADDR_LEN, ethernet addresses end up with the ':' at the end.

Then the ':'s in the string are converted to '-' for the net confile name and we end up with the extra '-'.

Comment 8 Jeff Bastian 2017-09-19 14:43:42 UTC
*** Bug 1479496 has been marked as a duplicate of this bug. ***

Comment 12 Lukas Zapletal 2017-10-26 11:52:18 UTC
*** Bug 1487107 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.