Don't put CORBA IDL dissectors in ASN1_ variables.
[metze/wireshark/wip.git] / dumpcap.c
index 9aae11b54bbde46529580798f82983344add8e07..7664a777b9a507be4ae30676a36d562c77c6d536 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -1447,6 +1447,18 @@ print_statistics_loop(gboolean machine_readable)
 
     for (if_entry = g_list_first(if_list); if_entry != NULL; if_entry = g_list_next(if_entry)) {
         if_info = (if_info_t *)if_entry->data;
+
+#ifdef __linux__
+        /* On Linux nf* interfaces don't collect stats properly and don't allows multiple
+         * connections. We avoid collecting stats on them.
+         */
+        if (!strncmp(if_info->name, "nf", 2)) {
+            g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Skipping interface %s for stats",
+                if_info->name);
+            continue;
+        }
+#endif
+
 #ifdef HAVE_PCAP_OPEN
         pch = pcap_open(if_info->name, MIN_PACKET_SIZE, 0, 0, NULL, errbuf);
 #else
@@ -1571,7 +1583,7 @@ report_capture_count(gboolean reportit)
 {
     /* Don't print this if we're a capture child. */
     if (!capture_child && reportit) {
-        fprintf(stderr, "\rPackets captured: %u\n", global_ld.packet_count);
+        fprintf(stderr, "\rPackets captured: %d\n", global_ld.packet_count);
         /* stderr could be line buffered */
         fflush(stderr);
     }
@@ -2870,13 +2882,13 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
     }
     if (ld->pdh) {
         if (capture_opts->use_pcapng) {
-            char appname[100];
-            GString             *os_info_str;
+            char    *appname;
+            GString *os_info_str;
 
             os_info_str = g_string_new("");
             get_os_version_info(os_info_str);
 
-            g_snprintf(appname, sizeof(appname), "Dumpcap (Wireshark) %s", get_ws_vcs_version_info());
+            appname = g_strdup_printf("Dumpcap (Wireshark) %s", get_ws_vcs_version_info());
             successful = pcapng_write_session_header_block(ld->pdh,
                                 (const char *)capture_opts->capture_comment,   /* Comment*/
                                 NULL,                        /* HW*/
@@ -2885,6 +2897,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
                                 -1,                          /* section_length */
                                 &ld->bytes_written,
                                 &err);
+            g_free(appname);
 
             for (i = 0; successful && (i < capture_opts->ifaces->len); i++) {
                 interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
@@ -3363,13 +3376,13 @@ do_file_switch_or_stop(capture_options *capture_opts,
             /* File switch succeeded: reset the conditions */
             global_ld.bytes_written = 0;
             if (capture_opts->use_pcapng) {
-                char appname[100];
-                GString             *os_info_str;
+                char    *appname;
+                GString *os_info_str;
 
                 os_info_str = g_string_new("");
                 get_os_version_info(os_info_str);
 
-                g_snprintf(appname, sizeof(appname), "Dumpcap (Wireshark) %s", get_ws_vcs_version_info());
+                appname = g_strdup_printf("Dumpcap (Wireshark) %s", get_ws_vcs_version_info());
                 successful = pcapng_write_session_header_block(global_ld.pdh,
                                 NULL,                        /* Comment */
                                 NULL,                        /* HW */
@@ -3378,6 +3391,7 @@ do_file_switch_or_stop(capture_options *capture_opts,
                                                                 -1,                          /* section_length */
                                 &(global_ld.bytes_written),
                                 &global_ld.err);
+                g_free(appname);
 
                 for (i = 0; successful && (i < capture_opts->ifaces->len); i++) {
                     interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
@@ -4967,7 +4981,7 @@ console_log_handler(const char *log_domain, GLogLevelFlags log_level,
         level = "Dbg ";
         break;
     default:
-        fprintf(stderr, "unknown log_level %u\n", log_level);
+        fprintf(stderr, "unknown log_level %d\n", log_level);
         level = NULL;
         g_assert_not_reached();
     }