Skip to content
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

NetworkPkg: UefiPxeBcDxe: Fix error packet detection #6287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dbnicholson
Copy link

Description

Per RFC 1350, TFTP error packets include 2 byte OpCode and ErrorCode fields in network byte order. Those need to be swapped to host order to be interpreted correctly. Without this change, the TftpErrorReceived and TftpError Mode fields are never set and EFI applications can't inspect the error received from the TFTP server.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

I was testing shim to see how it handles TFTP file not found errors in rhboot/shim#695. The OVMF firmware was used to boot a VM using QEMU's TFTP server support. Without this change shim would not report the specific error since TftpErrorReceived is FALSE. With this change it was able to see TftpErrorReceived is TRUE and TftpError.ErrorCode set to 1, which is file not found as expected.

Integration Instructions

N/A, will be included in the UefiPxeBcDxe package.

Per RFC 1350, TFTP error packets include 2 byte OpCode and ErrorCode
fields in network byte order. Those need to be swapped to host order to
be interpreted correctly. Without this change, the TftpErrorReceived and
TftpError Mode fields are never set and EFI applications can't inspect
the error received from the TFTP server.

Signed-off-by: Dan Nicholson <dbn@endlessos.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant