diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/netdev_settings.c | 22 | ||||
-rw-r--r-- | src/net/tcp/httpcore.c | 3 | ||||
-rw-r--r-- | src/net/udp/tftp.c | 11 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c index fb98663c..080b6d2a 100644 --- a/src/net/netdev_settings.c +++ b/src/net/netdev_settings.c @@ -65,6 +65,11 @@ const struct setting busid_setting __setting ( SETTING_NETDEV, busid ) = { .description = "Bus ID", .type = &setting_type_hex, }; +const struct setting linktype_setting __setting ( SETTING_NETDEV, linktype ) = { + .name = "linktype", + .description = "Link-layer type", + .type = &setting_type_string, +}; const struct setting chip_setting __setting ( SETTING_NETDEV, chip ) = { .name = "chip", .description = "Chip", @@ -220,6 +225,22 @@ static int netdev_fetch_busid ( struct net_device *netdev, void *data, } /** + * Fetch link layer type setting + * + * @v netdev Network device + * @v data Buffer to fill with setting data + * @v len Length of buffer + * @ret len Length of setting data, or negative error + */ +static int netdev_fetch_linktype ( struct net_device *netdev, void *data, + size_t len ) { + const char *linktype = netdev->ll_protocol->name; + + strncpy ( data, linktype, len ); + return strlen ( linktype ); +} + +/** * Fetch chip setting * * @v netdev Network device @@ -281,6 +302,7 @@ static struct netdev_setting_operation netdev_setting_operations[] = { { &bustype_setting, NULL, netdev_fetch_bustype }, { &busloc_setting, NULL, netdev_fetch_busloc }, { &busid_setting, NULL, netdev_fetch_busid }, + { &linktype_setting, NULL, netdev_fetch_linktype }, { &chip_setting, NULL, netdev_fetch_chip }, { &ifname_setting, NULL, netdev_fetch_ifname }, }; diff --git a/src/net/tcp/httpcore.c b/src/net/tcp/httpcore.c index 9ad39656..af2a237c 100644 --- a/src/net/tcp/httpcore.c +++ b/src/net/tcp/httpcore.c @@ -89,7 +89,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); __einfo_uniqify ( EINFO_EIO, 0x05, "HTTP 5xx Server Error" ) #define ENOENT_404 __einfo_error ( EINFO_ENOENT_404 ) #define EINFO_ENOENT_404 \ - __einfo_uniqify ( EINFO_ENOENT, 0x01, "HTTP 404 Not Found" ) + __einfo_uniqify ( EINFO_ENOENT, 0x01, "Not found" ) #define ENOTSUP_CONNECTION __einfo_error ( EINFO_ENOTSUP_CONNECTION ) #define EINFO_ENOTSUP_CONNECTION \ __einfo_uniqify ( EINFO_ENOTSUP, 0x01, "Unsupported connection header" ) @@ -114,6 +114,7 @@ static struct profiler http_xfer_profiler __profiler = { .name = "http.xfer" }; /** Human-readable error messages */ struct errortab http_errors[] __errortab = { + __einfo_errortab ( EINFO_ENOENT_404 ), __einfo_errortab ( EINFO_EIO_4XX ), __einfo_errortab ( EINFO_EIO_5XX ), }; 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; |