-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shim uses wrong TFTP server IP in proxyDHCP mode #165
Comments
I can reproduce the bug. Will see how to fix it. |
I reproduced the bug with shim 14 and found that it's fixed in git master. I believe the following commit fixes the issue. |
I tried with version 15+1533136590.3beb971-0ubuntu1 from https://packages.ubuntu.com/disco/shim and the issue is still there. Is there a more recent binary that I could test with? Thank you! |
I also tried with https://fedora.pkgs.org/29/fedora-x86_64/shim-x64-15-7.x86_64.rpm.html, same issue there as well. |
I built my own shim binary with b3e4d1f + a simple debug patch to print the IP address of pkt_v4 in parseDhcp4():netboot.c. |
This is most likely not a Shim issue but a Grub2 problem. The shim has proxy dhcp support but Grub2 does not. I believe it may be in the works for 2.03, but can't say for certain. |
@cdadmin, the initial issue was that grub isn't even started because it tries to be downloaded with settings from DHCP server - and not the settings from proxydhcp settings, as mentioned above this was maybe fixed in 5f4fd53, but either something else have happened after that, or distros are just horrible slow to update. |
Yup, my TFTP server logs prove that shim never tries to load grub from the proxyDHCP server. I did file an issue about adding proxyDHCP support in Grub though.
@lcp, when you say "while the host is the DHCP server", maybe that test isn't the same as mine? |
Please also remember that the TFTP server address should be read from next-server option, which is not the same as the DHCP server address. (even tho that they many times contains the same data) |
@NiKiZe |
I'm attaching a screenshot of the packet in wireshark.
|
Thanks. It appears this would not work since next server ip is not set. I think this would require some type of rework to Shim to support a proxy dhcp that does not set next-server. Alternatively, you could use a proxy dhcp server that does set the next server. |
By the way which version of dnsmasq are you using? |
dnsmasq has another option, I wonder if it would change anything? |
@cdadmin, I already had "dhcp-boot=tag:iPXE,boot.ipxe,10.161.254.11" in dnsmasq.conf set while I took the previous screenshot, but this is not used in proxyDHCP mode, it's only used when dnsmasq functions as a real DHCP server. In proxyDHCP mode only the pxe-service= options are used. I don't know of any other famous DHCP server that supports proxyDHCP, which one would you want me to test with? |
Btw, from the pxespec.pdf, page 31:
|
For reference, here is my testing environment: HOST [vmbr0] 192.168.110.1 DHCP server dnsmasq.conf in VM1: enable-tftp The shimx64.efi binary is based on b3e4d1f. I also built another binary after reverting 5f4fd53 . Per my test, the original shim loaded grub2 from VM1 and showed the grub2 shell. Besides, I found the DHCP offer from VM1 containing the next server, i.e. 192.168.110.3. |
@lcp, could you please upload your binary/binaries somewhere for me to test with? I'll test with secure boot off, so that the signing keys won't matter. Thank you! |
P.S. to be clear, your DHCP server=192.168.110.1 doesn't mention your proxyDHCP server IP=192.168.110.3 anywhere in its configuration, right? |
Here is my dhcpd.conf in the host: option routers 192.168.110.1; So the DHCP server unlikely sends anything about 192.168.110.3. I'll build the testing binaries later. |
I've tested the attached shim binary, and it works for me. |
I typically use Shim with my implementation of ProxyDHCP and it has worked since 5f4fd53. I decided to test it with dnsmasq to look for differences and my results are aligning with @lcp. My setup includes: I also use a patched version of Grub2 for proxy support. I tested with Shim14 and Grub2 doesn't load, from the logs, it is never even requested. I confirmed with Wireshark, and can see 2 DHCP offers, one from DHCP and one from Proxy. Only the proxy offer contained the boot info. The strange thing is that my Proxy Offer did include the next server option. So for me, dnsmasq is setting the next-server which explains why it works. |
I tried with shimx64-b3e4d1f.zip and with the aforementioned 4-line dnsmasq.conf (except I also added port=0) and again it didn't work for me. Tomorrow I'll try with a real client, in case the use of VirtualBox or iPXE somehow interfere. Would it be possible for me to test some patch or build that can read the proxyDHCP server from option 54? Thank you for your awesome support! |
Shim doesn't parse the DHCP packet directly. It relies on the PXE Base Code protocol provided by UEFI firmware. As you can see here: Actually, option 54 is parsed In edk2 stable 201811: I suspect that your firmware doesn't parsed the DHCP offer correctly. Maybe you can try the latest OVMF. |
Oh! Wait. It seems the result of option 54 parsing isn't stored. So We have to figure out another way to get the option 54 in shim. |
Test results:
I will try to raise (3) with the iPXE developers as well, but I think that if shim manages to read option 54 then it will work with iPXE without any changes there. Also I don't know if any real PXE implementations would exist that would behave the same as iPXE, making shim fail. Thank you very much all again; if you decide not to work on option 54, you could close this or tell me to close it. Cheers! |
That sounds strange to me since there is no real functional change in netboot.c after 5f4fd53 so I don't know why 1 still failed. Anyway, I'll dig edk2 more to see how it works. |
I came here from https://bugs.launchpad.net/ubuntu/+source/shim/+bug/1813541 This request seams still unresolved. Even the newest ubuntu releases have no signed grub with a working proxyDHCP implementation. Is there any ongoing work? I could not find any further informations. Do you have any updates on this topic? |
This still seems to be an issue, at least for me. Is someone still working on it? |
I have same issue trying to PXE UEFI boot Debian installation. I'm using My DHCP server has |
This works fine:
UEFI > real DHCP > shimx64.efi over TFTP > grubx64.efi over TFTP.
In the scenario above, if we change "real" with "proxy", it fails, because it's trying to download grubx64.efi from the real DHCP server instead of the proxy one.
A proxy DHCP server is one that only sends the boot filename, and leaves the IP assignments to the real DHCP server. We use that a lot in the ltsp.org and in other netbooting projects, as it avoids the need for a special network setup.
I think the problem is in this line:
https://github.com/rhboot/shim/blob/master/netboot.c#L293
memcpy(&tftp_addr.v4, pkt_v4->BootpSiAddr, 4);
There should be an "if proxy ... use that one for tftp ... else use BootpSiAddr" at that point.
Sample dnsmasq.conf for proxy setup, for testing:
The text was updated successfully, but these errors were encountered: