epan: Allow FT_ETHER custom columns to be resolved or not

Have proto_item_fill_display_label (which is used for custom
columns resolved type and packet diagrams) use address_to_display
for FT_ETHER. This is resolved when name resolution for MAC
Addresses is enabled.

Add FT_ETHER to the list of types that, if present in a custom
column, has the GUI enable the checkbox to switch between "resolved"
and "unresolved" text.

This allows FT_ETHER custom columns to be displayed as either
resolved addresses or unresolved. (Note that to be displayed
as resolved, the column resolved option must be checked and
the name resolution preference enabled.)

Fix #18665
This commit is contained in:
John Thacker 2022-12-16 20:36:42 -05:00
parent 2bc72fa3db
commit dbb9fe2a37
3 changed files with 5 additions and 4 deletions

View File

@ -6668,8 +6668,9 @@ proto_item_fill_display_label(field_info *finfo, gchar *display_label_str, const
case FT_ETHER:
set_address (&addr, AT_ETHER, FT_ETHER_LEN, fvalue_get_bytes(&finfo->value));
address_to_str_buf(&addr, display_label_str, label_str_size);
label_len = (int)strlen(display_label_str);
tmp_str = address_to_display(NULL, &addr);
label_len = protoo_strlcpy(display_label_str, tmp_str, label_str_size);
wmem_free(NULL, tmp_str);
break;
case FT_GUID:

View File

@ -91,7 +91,7 @@ resolve_column (gint col, capture_file *cf)
hfi = proto_registrar_get_nth(*field_idx);
/* Check if we have an OID or a strings table with integer values */
if ((hfi->type == FT_OID) || (hfi->type == FT_REL_OID) || (hfi->type == FT_BOOLEAN) ||
if ((hfi->type == FT_OID) || (hfi->type == FT_REL_OID) || (hfi->type == FT_ETHER) || (hfi->type == FT_BOOLEAN) ||
((hfi->strings != NULL) &&
(IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type))))
{

View File

@ -242,7 +242,7 @@ column_prefs_custom_resolve(const gchar* custom_field)
for (guint i = 0; i < g_strv_length(fields); i++) {
if (fields[i] && *fields[i]) {
hfi = proto_registrar_get_byname(fields[i]);
if (hfi && ((hfi->type == FT_OID) || (hfi->type == FT_REL_OID) || (hfi->type == FT_BOOLEAN) ||
if (hfi && ((hfi->type == FT_OID) || (hfi->type == FT_REL_OID) || (hfi->type == FT_ETHER) || (hfi->type == FT_BOOLEAN) ||
((hfi->strings != NULL) &&
(IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type)))))
{