summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2024-03-29 13:38:09 +0100
committerMichael Brown2024-03-29 15:46:13 +0100
commitafae8817826ef8356b89a5e131ff42750ab267d4 (patch)
tree24abe4f1e146a142a0bb8f241038794f81e0d5e4
parent[efi] Add error table entry for local filesystem EFI_NOT_FOUND error (diff)
downloadipxe-afae8817826ef8356b89a5e131ff42750ab267d4.tar.gz
ipxe-afae8817826ef8356b89a5e131ff42750ab267d4.tar.xz
ipxe-afae8817826ef8356b89a5e131ff42750ab267d4.zip
[tftp] Add error table entry for TFTP "file not found" error code
Add an abbreviated "Not found" error message for a TFTP "file not found" error code, so that any automatic attempt to download a non-existent autoexec.ipxe script produces only a minimal error message. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/net/udp/tftp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c
index 3073e682..2ee01862 100644
--- a/src/net/udp/tftp.c
+++ b/src/net/udp/tftp.c
@@ -44,6 +44,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/dhcp.h>
#include <ipxe/uri.h>
#include <ipxe/profile.h>
+#include <ipxe/errortab.h>
#include <ipxe/tftp.h>
/** @file
@@ -76,6 +77,9 @@ FEATURE ( FEATURE_PROTOCOL, "TFTP", DHCP_EB_FEATURE_TFTP, 1 );
#define EINVAL_MC_INVALID_PORT __einfo_error ( EINFO_EINVAL_MC_INVALID_PORT )
#define EINFO_EINVAL_MC_INVALID_PORT __einfo_uniqify \
( EINFO_EINVAL, 0x07, "Invalid multicast port" )
+#define ENOENT_NOT_FOUND __einfo_error ( EINFO_ENOENT_NOT_FOUND )
+#define EINFO_ENOENT_NOT_FOUND __einfo_uniqify \
+ ( EINFO_ENOENT, 0x01, "Not found" )
/**
* A TFTP request
@@ -167,6 +171,11 @@ static struct profiler tftp_client_profiler __profiler =
static struct profiler tftp_server_profiler __profiler =
{ .name = "tftp.server" };
+/** Human-readable error messages */
+struct errortab tftp_errors[] __errortab = {
+ __einfo_errortab ( EINFO_ENOENT_NOT_FOUND ),
+};
+
/**
* Free TFTP request
*
@@ -872,7 +881,7 @@ static int tftp_rx_data ( struct tftp_request *tftp,
*/
static int tftp_errcode_to_rc ( unsigned int errcode ) {
switch ( errcode ) {
- case TFTP_ERR_FILE_NOT_FOUND: return -ENOENT;
+ case TFTP_ERR_FILE_NOT_FOUND: return -ENOENT_NOT_FOUND;
case TFTP_ERR_ACCESS_DENIED: return -EACCES;
case TFTP_ERR_ILLEGAL_OP: return -ENOTTY;
default: return -ENOTSUP;