From 0187c41d88b372e90eff37e3c29b78423e3f170e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 31 Dec 2013 19:29:52 +0200 Subject: [PATCH] Declare wpa_debug_* variables in src/utils/wpa_debug.h These were somewhat more hidden to avoid direct use, but there are now numerous places where these are needed and more justification to make the extern int declarations available from wpa_debug.h. In addition, this avoids some warnings from sparse. Signed-hostap: Jouni Malinen --- eap_example/eap_example.c | 2 -- hostapd/main.c | 5 ----- radius_example/radius_example.c | 2 -- src/ap/hostapd.c | 2 -- src/crypto/tls_gnutls.c | 2 -- src/crypto/tls_openssl.c | 1 - src/radius/radius_das.c | 3 --- src/radius/radius_server.c | 2 -- src/utils/wpa_debug.h | 4 ++++ tests/test-asn1.c | 2 -- tests/test-https.c | 3 --- tests/test-milenage.c | 3 --- tests/test-x509.c | 2 -- tests/test-x509v3.c | 2 -- wlantest/rx_data.c | 2 -- wlantest/rx_eapol.c | 2 -- wlantest/test_vectors.c | 4 ---- wlantest/wlantest.c | 5 ----- wpa_supplicant/ctrl_iface.c | 3 --- wpa_supplicant/dbus/dbus_new_handlers.c | 4 ---- wpa_supplicant/dbus/dbus_old_handlers.c | 4 ---- wpa_supplicant/eapol_test.c | 3 --- wpa_supplicant/preauth_test.c | 3 --- wpa_supplicant/tests/test_wpa.c | 4 ---- wpa_supplicant/wpa_priv.c | 2 -- wpa_supplicant/wpa_supplicant.c | 4 ---- wpa_supplicant/wps_supplicant.c | 2 -- 27 files changed, 4 insertions(+), 73 deletions(-) diff --git a/eap_example/eap_example.c b/eap_example/eap_example.c index 68f3c002c..8a48cd34b 100644 --- a/eap_example/eap_example.c +++ b/eap_example/eap_example.c @@ -23,8 +23,6 @@ void eap_example_server_deinit(void); int eap_example_server_step(void); -extern int wpa_debug_level; - int main(int argc, char *argv[]) { int res_s, res_p; diff --git a/hostapd/main.c b/hostapd/main.c index 1b798dafc..196bccc71 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -29,11 +29,6 @@ #include "ctrl_iface.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - - struct hapd_global { void **drv_priv; size_t drv_count; diff --git a/radius_example/radius_example.c b/radius_example/radius_example.c index cb0e15430..e4b367863 100644 --- a/radius_example/radius_example.c +++ b/radius_example/radius_example.c @@ -13,8 +13,6 @@ #include "radius/radius.h" #include "radius/radius_client.h" -extern int wpa_debug_level; - struct radius_ctx { struct radius_client_data *radius; struct hostapd_radius_servers conf; diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 71f8ee2b4..44d05c5d8 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -41,8 +41,6 @@ static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd); static int setup_interface2(struct hostapd_iface *iface); static void channel_list_update_timeout(void *eloop_ctx, void *timeout_ctx); -extern int wpa_debug_level; - int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, diff --git a/src/crypto/tls_gnutls.c b/src/crypto/tls_gnutls.c index a5d72f407..cb23eb9c5 100644 --- a/src/crypto/tls_gnutls.c +++ b/src/crypto/tls_gnutls.c @@ -125,8 +125,6 @@ static void tls_log_func(int level, const char *msg) } -extern int wpa_debug_show_keys; - void * tls_init(const struct tls_config *conf) { struct tls_global *global; diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c index 257d95abe..d025ae0a8 100644 --- a/src/crypto/tls_openssl.c +++ b/src/crypto/tls_openssl.c @@ -2901,7 +2901,6 @@ int tls_connection_get_write_alerts(void *ssl_ctx, struct tls_connection *conn) static void ocsp_debug_print_resp(OCSP_RESPONSE *rsp) { #ifndef CONFIG_NO_STDOUT_DEBUG - extern int wpa_debug_level; BIO *out; size_t rlen; char *txt; diff --git a/src/radius/radius_das.c b/src/radius/radius_das.c index 418b1605c..b2a27735b 100644 --- a/src/radius/radius_das.c +++ b/src/radius/radius_das.c @@ -16,9 +16,6 @@ #include "radius_das.h" -extern int wpa_debug_level; - - struct radius_das_data { int sock; u8 *shared_secret; diff --git a/src/radius/radius_server.c b/src/radius/radius_server.c index 48b3c7008..1063d65ac 100644 --- a/src/radius/radius_server.c +++ b/src/radius/radius_server.c @@ -298,8 +298,6 @@ struct radius_server_data { }; -extern int wpa_debug_level; - #define RADIUS_DEBUG(args...) \ wpa_printf(MSG_DEBUG, "RADIUS SRV: " args) #define RADIUS_ERROR(args...) \ diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h index 0013cf20a..50e8ae9d5 100644 --- a/src/utils/wpa_debug.h +++ b/src/utils/wpa_debug.h @@ -11,6 +11,10 @@ #include "wpabuf.h" +extern int wpa_debug_level; +extern int wpa_debug_show_keys; +extern int wpa_debug_timestamp; + /* Debugging function - conditional printf and hex dump. Driver wrappers can * use these for debugging purposes. */ diff --git a/tests/test-asn1.c b/tests/test-asn1.c index 7b6f7be23..c6957fd25 100644 --- a/tests/test-asn1.c +++ b/tests/test-asn1.c @@ -11,8 +11,6 @@ #include "common.h" #include "tls/asn1.h" -extern int wpa_debug_level; - static const char * asn1_class_str(int class) { diff --git a/tests/test-https.c b/tests/test-https.c index 2f41500c9..a72e56f9d 100644 --- a/tests/test-https.c +++ b/tests/test-https.c @@ -12,9 +12,6 @@ #include "common.h" #include "crypto/tls.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; - static void https_tls_event_cb(void *ctx, enum tls_event ev, union tls_event_data *data) diff --git a/tests/test-milenage.c b/tests/test-milenage.c index 9d2f7f0cc..7c4be0902 100644 --- a/tests/test-milenage.c +++ b/tests/test-milenage.c @@ -5,9 +5,6 @@ #include "crypto/milenage.h" -extern int wpa_debug_level; - - /** * milenage_opc - Determine OPc from OP and K * @op: OP = 128-bit operator variant algorithm configuration field diff --git a/tests/test-x509.c b/tests/test-x509.c index e92ea613c..194f229e9 100644 --- a/tests/test-x509.c +++ b/tests/test-x509.c @@ -11,8 +11,6 @@ #include "common.h" #include "tls/x509v3.h" -extern int wpa_debug_level; - int main(int argc, char *argv[]) { diff --git a/tests/test-x509v3.c b/tests/test-x509v3.c index 1290b5cee..bfb069871 100644 --- a/tests/test-x509v3.c +++ b/tests/test-x509v3.c @@ -12,8 +12,6 @@ #include "tls/asn1.h" #include "tls/x509v3.h" -extern int wpa_debug_level; - int main(int argc, char *argv[]) { diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c index d23425e4a..dec5857ea 100644 --- a/wlantest/rx_data.c +++ b/wlantest/rx_data.c @@ -14,8 +14,6 @@ #include "common/ieee802_11_defs.h" #include "wlantest.h" -extern int wpa_debug_level; - static const char * data_stype(u16 stype) { diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c index 463e84180..5e1ad349a 100644 --- a/wlantest/rx_eapol.c +++ b/wlantest/rx_eapol.c @@ -19,8 +19,6 @@ #include "rsn_supp/wpa_ie.h" #include "wlantest.h" -extern int wpa_debug_level; - static int is_zero(const u8 *buf, size_t len) { diff --git a/wlantest/test_vectors.c b/wlantest/test_vectors.c index 2320a7e9a..0800db7f3 100644 --- a/wlantest/test_vectors.c +++ b/wlantest/test_vectors.c @@ -13,10 +13,6 @@ #include "wlantest.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; - - static void test_vector_tkip(void) { u8 tk[] = { diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c index d1b550e8c..a2141414a 100644 --- a/wlantest/wlantest.c +++ b/wlantest/wlantest.c @@ -13,11 +13,6 @@ #include "wlantest.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - - static void wlantest_terminate(int sig, void *signal_ctx) { eloop_terminate(); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 975e42c93..7d7576f6e 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -1750,9 +1750,6 @@ static int wpa_supplicant_ctrl_iface_blacklist(struct wpa_supplicant *wpa_s, } -extern int wpa_debug_level; -extern int wpa_debug_timestamp; - static const char * debug_level_str(int level) { switch (level) { diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 4a2261aba..5380b430a 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -28,10 +28,6 @@ #include "dbus_dict_helpers.h" #include "dbus_common_i.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - static const char *debug_strings[] = { "excessive", "msgdump", "debug", "info", "warning", "error", NULL }; diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c index 6d178f459..7c4630e47 100644 --- a/wpa_supplicant/dbus/dbus_old_handlers.c +++ b/wpa_supplicant/dbus/dbus_old_handlers.c @@ -25,10 +25,6 @@ #include "dbus_old_handlers.h" #include "dbus_dict_helpers.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - /** * wpas_dbus_new_invalid_opts_error - Return a new invalid options error message * @message: Pointer to incoming dbus message this error refers to diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c index 2b25b6995..cb7147548 100644 --- a/wpa_supplicant/eapol_test.c +++ b/wpa_supplicant/eapol_test.c @@ -30,9 +30,6 @@ #include "wpas_glue.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; - struct wpa_driver_ops *wpa_drivers[] = { NULL }; diff --git a/wpa_supplicant/preauth_test.c b/wpa_supplicant/preauth_test.c index ff2ae747a..ed5708585 100644 --- a/wpa_supplicant/preauth_test.c +++ b/wpa_supplicant/preauth_test.c @@ -27,9 +27,6 @@ #include "drivers/driver.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; - struct wpa_driver_ops *wpa_drivers[] = { NULL }; diff --git a/wpa_supplicant/tests/test_wpa.c b/wpa_supplicant/tests/test_wpa.c index 484a4068f..39971f285 100644 --- a/wpa_supplicant/tests/test_wpa.c +++ b/wpa_supplicant/tests/test_wpa.c @@ -17,10 +17,6 @@ #include "ap/wpa_auth.h" -extern int wpa_debug_level; -extern int wpa_debug_show_keys; - - struct wpa { u8 auth_addr[ETH_ALEN]; u8 supp_addr[ETH_ALEN]; diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c index 3c4355a19..5426177a5 100644 --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c @@ -944,8 +944,6 @@ static void usage(void) } -extern int wpa_debug_level; - int main(int argc, char *argv[]) { int c, i; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index d3e11acaf..31e71f1be 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -104,10 +104,6 @@ const char *wpa_supplicant_full_license5 = "\n"; #endif /* CONFIG_NO_STDOUT_DEBUG */ -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - /* Configure default/group WEP keys for static WEP */ int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index bd4d16676..51d47c392 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -2319,8 +2319,6 @@ int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s, #endif /* CONFIG_WPS_NFC */ -extern int wpa_debug_level; - static void wpas_wps_dump_ap_info(struct wpa_supplicant *wpa_s) { size_t i;