diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2016-09-22 13:23:37 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2016-09-23 08:13:43 +0000 |
commit | 0703c7b4145f1ec23172b261356ca65bb17d12dc (patch) | |
tree | fc45171b65a56537b30534539480c999e6521b62 /dumpcap.c | |
parent | 00c862e4056be43d91beb2c6b66b996140e5d280 (diff) |
dumpcap: Include CPU info as hardware description in SHB
Add CPU info as hardware description in session header block when
using pcapng.
Use capture_comment from the capture_options structure when using
ring buffer.
Change-Id: I5e688fc2d6ab61de1f64ad9a8a96e6e39e8cf708
Reviewed-on: https://code.wireshark.org/review/17862
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -106,6 +106,7 @@ #include "wsutil/tempfile.h" #include "log.h" #include "wsutil/file_util.h" +#include "wsutil/cpu_info.h" #include "wsutil/os_version_info.h" #include "wsutil/str_util.h" #include "wsutil/inet_addr.h" @@ -2412,16 +2413,19 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err if (ld->pdh) { if (capture_opts->use_pcapng) { char *appname; + GString *cpu_info_str; GString *os_info_str; + cpu_info_str = g_string_new(""); os_info_str = g_string_new(""); + get_cpu_info(cpu_info_str); get_os_version_info(os_info_str); 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*/ - os_info_str->str, /* OS*/ + (const char *)capture_opts->capture_comment, /* Comment */ + cpu_info_str->str, /* HW */ + os_info_str->str, /* OS */ appname, -1, /* section_length */ &ld->bytes_written, @@ -2911,18 +2915,21 @@ do_file_switch_or_stop(capture_options *capture_opts, global_ld.bytes_written = 0; if (capture_opts->use_pcapng) { char *appname; + GString *cpu_info_str; GString *os_info_str; + cpu_info_str = g_string_new(""); os_info_str = g_string_new(""); + get_cpu_info(cpu_info_str); get_os_version_info(os_info_str); 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 */ + (const char *)capture_opts->capture_comment, /* Comment */ + cpu_info_str->str, /* HW */ os_info_str->str, /* OS */ appname, - -1, /* section_length */ + -1, /* section_length */ &(global_ld.bytes_written), &global_ld.err); g_free(appname); |