]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add -T Linux tracing option
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Oct 2013 18:29:58 +0000 (19:29 +0100)
committerJouni Malinen <j@w1.fi>
Thu, 31 Oct 2013 08:47:44 +0000 (10:47 +0200)
Just like wpa_supplicant, give hostapd the -T option to
send all debug messages into the Linux tracing buffer.
Enable this option for hwsim test builds by default.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

hostapd/Makefile
hostapd/defconfig
hostapd/main.c
tests/hwsim/example-hostapd.config
tests/hwsim/start.sh

index c56d3687628fe4ce9ebad3cce0b029843f7b4511..87ff9b4fefe3bdd4c49608e9bd32b936bfbbdac6 100644 (file)
@@ -828,6 +828,10 @@ ifdef CONFIG_NO_STDOUT_DEBUG
 CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
 endif
 
+ifdef CONFIG_DEBUG_LINUX_TRACING
+CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
+endif
+
 ifdef CONFIG_DEBUG_FILE
 CFLAGS += -DCONFIG_DEBUG_FILE
 endif
index 2dd6fc824a5d791df97a0365526c441bc9deb8e9..3f2924b9160447bfa03429b67921cd1c4515ba44 100644 (file)
@@ -157,6 +157,12 @@ CONFIG_IPV6=y
 # Disabled by default.
 #CONFIG_DEBUG_FILE=y
 
+# Add support for sending all debug messages (regardless of debug verbosity)
+# to the Linux kernel tracing facility. This helps debug the entire stack by
+# making it easy to record everything happening from the driver up into the
+# same file, e.g., using trace-cmd.
+#CONFIG_DEBUG_LINUX_TRACING=y
+
 # Remove support for RADIUS accounting
 #CONFIG_NO_ACCOUNTING=y
 
index 23eef1a58b945834ec797cbdec1fc1f1f26dffb6..60417997b3b92055925340fe2ab7942dc1c8c8b1 100644 (file)
@@ -629,6 +629,10 @@ static void usage(void)
 #ifdef CONFIG_DEBUG_FILE
                "   -f   log output to debug file instead of stdout\n"
 #endif /* CONFIG_DEBUG_FILE */
+#ifdef CONFIG_DEBUG_LINUX_TRACING
+               "   -T = record to Linux tracing in addition to logging\n"
+               "        (records all messages regardless of debug verbosity)\n"
+#endif /* CONFIG_DEBUG_LINUX_TRACING */
                "   -t   include timestamps in some debug messages\n"
                "   -v   show hostapd version\n");
 
@@ -697,6 +701,9 @@ int main(int argc, char *argv[])
        const char *entropy_file = NULL;
        char **bss_config = NULL, **tmp_bss;
        size_t num_bss_configs = 0;
+#ifdef CONFIG_DEBUG_LINUX_TRACING
+       int enable_trace_dbg = 0;
+#endif /* CONFIG_DEBUG_LINUX_TRACING */
 
        if (os_program_init())
                return -1;
@@ -713,7 +720,7 @@ int main(int argc, char *argv[])
        interfaces.global_ctrl_sock = -1;
 
        for (;;) {
-               c = getopt(argc, argv, "b:Bde:f:hKP:tvg:G:");
+               c = getopt(argc, argv, "b:Bde:f:hKP:Ttvg:G:");
                if (c < 0)
                        break;
                switch (c) {
@@ -744,6 +751,11 @@ int main(int argc, char *argv[])
                case 't':
                        wpa_debug_timestamp++;
                        break;
+#ifdef CONFIG_DEBUG_LINUX_TRACING
+               case 'T':
+                       enable_trace_dbg = 1;
+                       break;
+#endif /* CONFIG_DEBUG_LINUX_TRACING */
                case 'v':
                        show_version();
                        exit(1);
@@ -779,6 +791,15 @@ int main(int argc, char *argv[])
 
        if (log_file)
                wpa_debug_open_file(log_file);
+#ifdef CONFIG_DEBUG_LINUX_TRACING
+       if (enable_trace_dbg) {
+               int tret = wpa_debug_open_linux_tracing();
+               if (tret) {
+                       wpa_printf(MSG_ERROR, "Failed to enable trace logging");
+                       return -1;
+               }
+       }
+#endif /* CONFIG_DEBUG_LINUX_TRACING */
 
        interfaces.count = argc - optind;
        if (interfaces.count || num_bss_configs) {
@@ -867,6 +888,7 @@ int main(int argc, char *argv[])
 
        if (log_file)
                wpa_debug_close_file();
+       wpa_debug_close_linux_tracing();
 
        os_free(bss_config);
 
index e0348da06688980567fddfe8831c71598161bf72..224aec0d0cc03e4b366d8d9ebefa07071e47d2f7 100644 (file)
@@ -57,6 +57,7 @@ CONFIG_WPA_TRACE_BFD=y
 
 CONFIG_P2P_MANAGER=y
 CONFIG_DEBUG_FILE=y
+CONFIG_DEBUG_LINUX_TRACING=y
 CONFIG_WPA_CLI_EDIT=y
 CONFIG_ACS=y
 CONFIG_NO_RANDOM_POOL=y
index 6ad9b5493121f1c20c9fa2d511a9c36f3c060c40..d2c806e6775372952dcb1f7adde66c5dd65ed5ff 100755 (executable)
@@ -64,7 +64,7 @@ for i in 0 1 2; do
     sudo $(printf -- "$VALGRIND_WPAS" $i) $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf \
          $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE > $LOGDIR/$DATE-log$i &
 done
-sudo $VALGRIND_HAPD $HAPD -ddKt -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/$DATE-hostapd &
+sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/$DATE-hostapd &
 
 sleep 1
 sudo chown $USER $LOGDIR/$DATE-hwsim0.dump