aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--file_packet_provider.c2
-rw-r--r--wiretap/merge.c19
-rw-r--r--wiretap/pcapng.c13
-rw-r--r--wiretap/wtap.c7
-rw-r--r--wiretap/wtap_opttypes.c9
-rw-r--r--wiretap/wtap_opttypes.h12
6 files changed, 59 insertions, 3 deletions
diff --git a/file_packet_provider.c b/file_packet_provider.c
index 3a0531388a..826e275a49 100644
--- a/file_packet_provider.c
+++ b/file_packet_provider.c
@@ -42,6 +42,8 @@ cap_file_provider_get_interface_name(struct packet_provider_data *prov, guint32
return interface_name;
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
+ if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_HARDWARE, &interface_name) == WTAP_OPTTYPE_SUCCESS)
+ return interface_name;
}
return "unknown";
}
diff --git a/wiretap/merge.c b/wiretap/merge.c
index d706f79ae8..55ceed040c 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -453,8 +453,11 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
guint64 idb1_if_speed, idb2_if_speed;
guint8 idb1_if_tsresol, idb2_if_tsresol;
guint8 idb1_if_fcslen, idb2_if_fcslen;
- char *idb1_opt_comment, *idb2_opt_comment, *idb1_if_name, *idb2_if_name,
- *idb1_if_description, *idb2_if_description, *idb1_if_os, *idb2_if_os;
+ char *idb1_opt_comment, *idb2_opt_comment;
+ char *idb1_if_name, *idb2_if_name;
+ char *idb1_if_description, *idb2_if_description;
+ char *idb1_if_hardware, *idb2_if_hardware;
+ char *idb1_if_os, *idb2_if_os;
g_assert(idb1 && idb2);
idb1_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb1);
@@ -578,6 +581,18 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
}
/* XXX - what do to if we have only one value? */
+ have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_HARDWARE, &idb1_if_hardware) == WTAP_OPTTYPE_SUCCESS);
+ have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_HARDWARE, &idb2_if_hardware) == WTAP_OPTTYPE_SUCCESS);
+ if (have_idb1_value && have_idb2_value) {
+ merge_debug("g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0: %s",
+ (g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0) ? "TRUE":"FALSE");
+ if (g_strcmp0(idb1_if_hardware, idb2_if_hardware) != 0) {
+ merge_debug("merge::is_duplicate_idb() returning FALSE");
+ return FALSE;
+ }
+ }
+
+ /* XXX - what do to if we have only one value? */
have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_OS, &idb1_if_os) == WTAP_OPTTYPE_SUCCESS);
have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_OS, &idb2_if_os) == WTAP_OPTTYPE_SUCCESS);
if (have_idb1_value && have_idb2_value) {
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index efd9054866..cfe28b91d6 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -939,6 +939,17 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
pcapng_debug("pcapng_read_if_descr_block: if_fcslen length %u not 1 as expected", oh.option_length);
}
break;
+ case(OPT_IDB_HARDWARE): /* if_hardware */
+ if (oh.option_length > 0 && oh.option_length < opt_cont_buf_len) {
+ tmp_content = g_strndup((char *)option_content, oh.option_length);
+ /* Fails with multiple options; we silently ignore the failure */
+ wtap_block_add_string_option(wblock->block, oh.option_code, option_content, oh.option_length);
+ pcapng_debug("pcapng_read_if_descr_block: if_hardware %s", tmp_content);
+ g_free(tmp_content);
+ } else {
+ pcapng_debug("pcapng_read_if_descr_block: if_description length %u seems strange", oh.option_length);
+ }
+ break;
/* TODO: process these! */
case(OPT_IDB_IP4ADDR):
@@ -3844,6 +3855,7 @@ static void compute_idb_option_size(wtap_block_t block _U_, guint option_id, wta
case OPT_IDB_NAME:
case OPT_IDB_DESCR:
case OPT_IDB_OS:
+ case OPT_IDB_HARDWARE:
size = pcapng_compute_option_string_size(optval->stringval);
break;
case OPT_IDB_SPEED:
@@ -3900,6 +3912,7 @@ static void write_wtap_idb_option(wtap_block_t block _U_, guint option_id, wtap_
case OPT_IDB_NAME:
case OPT_IDB_DESCR:
case OPT_IDB_OS:
+ case OPT_IDB_HARDWARE:
if (!pcapng_write_option_string(write_block->wdh, option_id, optval->stringval, write_block->err)) {
write_block->success = FALSE;
return;
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index de5ab7192b..259d3bf3f1 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -203,6 +203,13 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr,
wtap_encap_short_string(if_descr_mand->wtap_encap),
line_end);
+ if (wtap_block_get_string_option_value(if_descr, OPT_IDB_HARDWARE, &tmp_content) == WTAP_OPTTYPE_SUCCESS) {
+ g_string_append_printf(info,
+ "%*cHardware = %s%s", indent, ' ',
+ tmp_content ? tmp_content : "NONE",
+ line_end);
+ }
+
if (wtap_block_get_uint64_option_value(if_descr, OPT_IDB_SPEED, &tmp64) == WTAP_OPTTYPE_SUCCESS) {
g_string_append_printf(info,
"%*cSpeed = %" G_GINT64_MODIFIER "u%s", indent, ' ',
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index 34b779a470..91690d0e69 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -1073,6 +1073,14 @@ void wtap_opttypes_initialize(void)
NULL,
NULL
};
+ static wtap_opttype_t if_hardware = {
+ "hardware",
+ "IDB Hardware",
+ WTAP_OPTTYPE_STRING,
+ 0,
+ NULL,
+ NULL
+ };
static wtap_blocktype_t nrb_block = {
WTAP_BLOCK_NG_NRB, /* block_type */
@@ -1198,6 +1206,7 @@ void wtap_opttypes_initialize(void)
wtap_opttype_option_register(&idb_block, OPT_IDB_FILTER, &if_filter);
wtap_opttype_option_register(&idb_block, OPT_IDB_OS, &if_os);
wtap_opttype_option_register(&idb_block, OPT_IDB_FCSLEN, &if_fcslen);
+ wtap_opttype_option_register(&idb_block, OPT_IDB_HARDWARE, &if_hardware);
/*
* Register the NRB and the options that can appear in it.
diff --git a/wiretap/wtap_opttypes.h b/wiretap/wtap_opttypes.h
index ade7079ad2..328cd60a3e 100644
--- a/wiretap/wtap_opttypes.h
+++ b/wiretap/wtap_opttypes.h
@@ -44,7 +44,9 @@ extern "C" {
*/
#define OPT_IDB_DESCR 3 /**< A UTF-8 string containing the description
* of the device used to capture data.
- * "Broadcom NetXtreme" / "First Ethernet Interface"
+ * "Wi-Fi" / "Local Area Connection" /
+ * "Wireless Network Connection" /
+ * "First Ethernet Interface"
*/
#define OPT_IDB_IP4ADDR 4 /**< XXX: if_IPv4addr Interface network address and netmask.
* This option can be repeated multiple times within the same Interface Description Block
@@ -98,6 +100,14 @@ extern "C" {
* option if_tzone. TODO: won't a if_tsoffset_low for fractional
* second offsets be useful for highly syncronized capture systems?
*/
+#define OPT_IDB_HARDWARE 15 /**< A UTF-8 string containing the description
+ * of the hardware of the device used
+ * to capture data.
+ * "Broadcom NetXtreme" /
+ * "Intel(R) PRO/1000 MT Network Connection" /
+ * "NETGEAR WNA1000Mv2 N150 Wireless USB Micro Adapter"
+ */
+
#define OPT_NS_DNSNAME 2
#define OPT_NS_DNSIP4ADDR 3