diff options
author | Michael Brown <mcb30@ipxe.org> | 2010-05-30 15:29:05 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2010-05-31 03:11:57 +0100 |
commit | 6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac (patch) | |
tree | b04dd064c978bf0525649e9d1b936a9724deadaf /src/net/80211 | |
parent | d2415be06935a270a45fc62db18c5730f71171cb (diff) | |
download | ipxe-6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac.tar.gz |
[libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error
usage to be tracked.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/80211')
-rw-r--r-- | src/net/80211/net80211.c | 56 | ||||
-rw-r--r-- | src/net/80211/sec80211.c | 16 |
2 files changed, 31 insertions, 41 deletions
diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c index 8df2c3155..7b3911452 100644 --- a/src/net/80211/net80211.c +++ b/src/net/80211/net80211.c @@ -23,6 +23,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <string.h> #include <byteswap.h> #include <stdlib.h> +#include <unistd.h> +#include <errno.h> #include <ipxe/settings.h> #include <ipxe/if_arp.h> #include <ipxe/ethernet.h> @@ -32,52 +34,14 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/sec80211.h> #include <ipxe/timer.h> #include <ipxe/nap.h> -#include <unistd.h> -#include <errno.h> +#include <ipxe/errortab.h> +#include <ipxe/net80211_err.h> /** @file * * 802.11 device management */ -/* Disambiguate the EINVAL's a bit */ -#define EINVAL_PKT_TOO_SHORT ( EINVAL | EUNIQ_01 ) -#define EINVAL_PKT_VERSION ( EINVAL | EUNIQ_02 ) -#define EINVAL_PKT_NOT_DATA ( EINVAL | EUNIQ_03 ) -#define EINVAL_PKT_NOT_FROMDS ( EINVAL | EUNIQ_04 ) -#define EINVAL_PKT_LLC_HEADER ( EINVAL | EUNIQ_05 ) -#define EINVAL_CRYPTO_REQUEST ( EINVAL | EUNIQ_06 ) -#define EINVAL_ACTIVE_SCAN ( EINVAL | EUNIQ_07 ) - -/* - * 802.11 error codes: The AP can give us a status code explaining why - * authentication failed, or a reason code explaining why we were - * deauthenticated/disassociated. These codes range from 0-63 (the - * field is 16 bits wide, but only up to 45 or so are defined yet; we - * allow up to 63 for extensibility). This is encoded into an error - * code as such: - * - * status & 0x1f goes here --vv-- - * Status code 0-31: ECONNREFUSED | EUNIQ_(status & 0x1f) (0e1a6038) - * Status code 32-63: EHOSTUNREACH | EUNIQ_(status & 0x1f) (171a6011) - * Reason code 0-31: ECONNRESET | EUNIQ_(reason & 0x1f) (0f1a6039) - * Reason code 32-63: ENETRESET | EUNIQ_(reason & 0x1f) (271a6001) - * - * The POSIX error codes more or less convey the appropriate message - * (status codes occur when we can't associate at all, reason codes - * when we lose association unexpectedly) and let us extract the - * complete 802.11 error code from the rc value. - */ - -/** Make return status code from 802.11 status code */ -#define E80211_STATUS( stat ) ( ((stat & 0x20)? EHOSTUNREACH : ECONNREFUSED) \ - | ((stat & 0x1f) << 8) ) - -/** Make return status code from 802.11 reason code */ -#define E80211_REASON( reas ) ( ((reas & 0x20)? ENETRESET : ECONNRESET) \ - | ((reas & 0x1f) << 8) ) - - /** List of 802.11 devices */ static struct list_head net80211_devices = LIST_HEAD_INIT ( net80211_devices ); @@ -2838,3 +2802,15 @@ void net80211_tx_complete ( struct net80211_device *dev, /* Pass completion onward */ netdev_tx_complete_err ( dev->netdev, iob, rc ); } + +/** Common 802.11 errors */ +struct errortab common_wireless_errors[] __errortab = { + __einfo_errortab ( EINFO_EINVAL_CRYPTO_REQUEST ), + __einfo_errortab ( EINFO_ECONNRESET_UNSPECIFIED ), + __einfo_errortab ( EINFO_ECONNRESET_INACTIVITY ), + __einfo_errortab ( EINFO_ECONNRESET_4WAY_TIMEOUT ), + __einfo_errortab ( EINFO_ECONNRESET_8021X_FAILURE ), + __einfo_errortab ( EINFO_ECONNREFUSED_FAILURE ), + __einfo_errortab ( EINFO_ECONNREFUSED_ASSOC_DENIED ), + __einfo_errortab ( EINFO_ECONNREFUSED_AUTH_ALGO_UNSUPP ), +}; diff --git a/src/net/80211/sec80211.c b/src/net/80211/sec80211.c index 69fad8ffc..ea4b0d006 100644 --- a/src/net/80211/sec80211.c +++ b/src/net/80211/sec80211.c @@ -34,6 +34,20 @@ FILE_LICENCE ( GPL2_OR_LATER ); * static data in this file. */ +/* Unsupported cryptosystem error numbers */ +#define ENOTSUP_WEP __einfo_error ( EINFO_ENOTSUP_WEP ) +#define EINFO_ENOTSUP_WEP __einfo_uniqify ( EINFO_ENOTSUP, \ + ( 0x10 | NET80211_CRYPT_WEP ), "WEP not supported" ) +#define ENOTSUP_TKIP __einfo_error ( EINFO_ENOTSUP_TKIP ) +#define EINFO_ENOTSUP_TKIP __einfo_uniqify ( EINFO_ENOTSUP, \ + ( 0x10 | NET80211_CRYPT_TKIP ), "TKIP not supported" ) +#define ENOTSUP_CCMP __einfo_error ( EINFO_ENOTSUP_CCMP ) +#define EINFO_ENOTSUP_CCMP __einfo_uniqify ( EINFO_ENOTSUP, \ + ( 0x10 | NET80211_CRYPT_CCMP ), "CCMP not supported" ) +#define ENOTSUP_CRYPT( crypt ) \ + EUNIQ ( ENOTSUP, ( 0x10 | (crypt) ), \ + ENOTSUP_WEP, ENOTSUP_TKIP, ENOTSUP_CCMP ) + /** Mapping from net80211 crypto/secprot types to RSN OUI descriptors */ struct descriptor_map { /** Value of net80211_crypto_alg or net80211_security_proto */ @@ -130,7 +144,7 @@ int sec80211_install ( struct net80211_crypto **which, if ( ! crypto ) { DBG ( "802.11-Sec no support for cryptosystem %d\n", crypt ); - return -( ENOTSUP | EUNIQ_10 | ( crypt << 8 ) ); + return -ENOTSUP_CRYPT ( crypt ); } *which = crypto; |