MySQL: Reduce noise related to length encoded ints

Length encoded integers were:
- Reported as `mariadb.prefix` and `mariadb.length` but were not specific to MariaDB specific protocol features.
- These were reported in the UI as "Length" and "Prefix" and were in many cases the same as 1 byte integers are very common.
- These were often duplicating things like `hf_mysql_connattrs_length`, `hf_mysql_connattrs_name_length`, etc which meant that the same length was often reported 3 times in the interface.
This commit is contained in:
Daniël van Eeden 2023-01-23 09:35:45 +01:00 committed by Alexis La Goutte
parent 2d2528cc2f
commit 0ba90d1249
1 changed files with 13 additions and 29 deletions

View File

@ -1149,8 +1149,6 @@ static int hf_mysql_pubkey = -1;
static int hf_mysql_compressed_packet_length = -1;
static int hf_mysql_compressed_packet_length_uncompressed = -1;
static int hf_mysql_compressed_packet_number = -1;
static int hf_mysql_prefix = -1;
static int hf_mysql_length = -1;
//static int hf_mariadb_fld_charsetnr = -1;
static int hf_mariadb_server_language = -1;
static int hf_mariadb_charset = -1;
@ -3700,18 +3698,19 @@ my_tvb_strsize(tvbuff_t *tvb, int offset)
read FLE from packet buffer and store its value and ISNULL flag
in caller provided variables
Docs: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_dt_integers.html
RETURN VALUE
length of FLE
*/
static int
tvb_get_fle(tvbuff_t *tvb, proto_tree *tree, int offset, guint64 *res, guint8 *is_null)
tvb_get_fle(tvbuff_t *tvb, proto_tree *tree _U_, int offset, guint64 *res, guint8 *is_null)
{
guint32 prefix;
proto_item* ti;
int num_bytes, len_len;
guint8 prefix;
int num_bytes;
guint64 length;
ti = proto_tree_add_item_ret_uint(tree, hf_mysql_prefix, tvb, offset, 1, ENC_BIG_ENDIAN, &prefix);
prefix = tvb_get_guint8(tvb, offset);
if (is_null) {
*is_null = 0;
@ -3723,32 +3722,27 @@ tvb_get_fle(tvbuff_t *tvb, proto_tree *tree, int offset, guint64 *res, guint8 *i
*res = 0;
if (is_null)
*is_null = 1;
proto_item_append_text(ti, "(NULL)");
return 1;
case 252:
proto_item_append_text(ti, " Length in following 2 bytes");
case 252: // 0xFC
num_bytes = 3;
len_len = 2;
offset++;
length = (guint64)tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN);
break;
case 253:
proto_item_append_text(ti, " Length in following 3 bytes");
case 253: // 0xFD
num_bytes = 4;
len_len = 3;
offset++;
length = (guint64)tvb_get_guint24(tvb, offset, ENC_LITTLE_ENDIAN);
break;
case 254:
proto_item_append_text(ti, " Length in following 8 bytes");
case 254: // 0xFE
num_bytes = 9;
len_len = 8;
offset++;
length = tvb_get_guint64(tvb, offset, ENC_LITTLE_ENDIAN);
break;
default:
len_len = 1;
num_bytes = 1;
length = tvb_get_guint8(tvb, offset);
}
proto_tree_add_item_ret_uint64(tree, hf_mysql_length, tvb, offset, len_len, ENC_LITTLE_ENDIAN, &length);
if (res) {
*res = length;
}
@ -5153,16 +5147,6 @@ void proto_register_mysql(void)
{ "Row nr", "mariadb.bulk.row_nr",
FT_UINT32, BASE_DEC, NULL, 0x00,
NULL, HFILL }},
{ &hf_mysql_prefix,
{ "Prefix", "mariadb.prefix",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }},
{ &hf_mysql_length,
{ "Length", "mariadb.length",
FT_UINT64, BASE_DEC, NULL, 0x00,
NULL, HFILL }}
};
static gint *ett[]=