NetworkPkg: UefiPxeBcDxe: Fix error packet detection #6287
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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
isFALSE
. With this change it was able to seeTftpErrorReceived
isTRUE
andTftpError.ErrorCode
set to1
, which is file not found as expected.Integration Instructions
N/A, will be included in the UefiPxeBcDxe package.