diff options
author | Guy Harris <guy@alum.mit.edu> | 2020-03-27 20:08:33 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-03-28 03:34:18 +0000 |
commit | fd88bfa348677ec7bdd95d6a7130a08212ee98f7 (patch) | |
tree | 979a32097209379646ce4dccb107859ce52e04df /writecap/pcapio.c | |
parent | 5e77ab8b9512519c7e975bbbac264a2241904bc6 (diff) |
Write the if_hardware option, if available, to pcapng files when capturing.
Change-Id: Ib9ff78d148a2364c84d84b4a9b020b3d783654a3
Reviewed-on: https://code.wireshark.org/review/36602
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'writecap/pcapio.c')
-rw-r--r-- | writecap/pcapio.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/writecap/pcapio.c b/writecap/pcapio.c index 00237e2e1b..14e4d7f31b 100644 --- a/writecap/pcapio.c +++ b/writecap/pcapio.c @@ -157,6 +157,7 @@ struct option { #define IDB_TSRESOL 9 #define IDB_FILTER 11 #define IDB_OS 12 +#define IDB_HARDWARE 15 #define ISB_STARTTIME 2 #define ISB_ENDTIME 3 #define ISB_IFRECV 4 @@ -370,16 +371,17 @@ pcapng_write_section_header_block(FILE* pfile, gboolean pcapng_write_interface_description_block(FILE* pfile, - const char *comment, /* OPT_COMMENT 1 */ - const char *name, /* IDB_NAME 2 */ - const char *descr, /* IDB_DESCRIPTION 3 */ - const char *filter, /* IDB_FILTER 11 */ - const char *os, /* IDB_OS 12 */ + const char *comment, /* OPT_COMMENT 1 */ + const char *name, /* IDB_NAME 2 */ + const char *descr, /* IDB_DESCRIPTION 3 */ + const char *filter, /* IDB_FILTER 11 */ + const char *os, /* IDB_OS 12 */ + const char *hardware, /* IDB_HARDWARE 15 */ int link_type, int snap_len, guint64 *bytes_written, - guint64 if_speed, /* IDB_IF_SPEED 8 */ - guint8 tsresol, /* IDB_TSRESOL 9 */ + guint64 if_speed, /* IDB_IF_SPEED 8 */ + guint8 tsresol, /* IDB_TSRESOL 9 */ int *err) { struct idb idb; @@ -421,6 +423,9 @@ pcapng_write_interface_description_block(FILE* pfile, /* 12 - IDB_OS */ options_length += pcapng_count_string_option(os); + /* 15 - IDB_HARDWARE */ + options_length += pcapng_count_string_option(hardware); + /* If we have options add size of end-of-options */ if (options_length != 0) { options_length += (guint32)sizeof(struct option); @@ -504,6 +509,11 @@ pcapng_write_interface_description_block(FILE* pfile, bytes_written, err)) return FALSE; + /* 15 - IDB_HARDWARE - write hardware string if applicable */ + if (!pcapng_write_string_option(pfile, IDB_HARDWARE, hardware, + bytes_written, err)) + return FALSE; + if (options_length != 0) { /* write end of options */ option.type = OPT_ENDOFOPT; |