aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dhcp.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2021-02-06 19:29:36 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-02-07 20:38:08 +0000
commit9337e1cd530be80c033196788bb825cc2fd4af08 (patch)
treec90b6fe9c13f15aea5bc2cf7f47834987a48305f /epan/dissectors/packet-dhcp.c
parent395af33e745a94ea11debe14c02304d0f79852e1 (diff)
dhcp: populate stats table rows only once
If the init function is called and the statistics table already exists, it's sufficient to clear the data that was collected when the tap parsed the packets. Fixes: f21f1c292a ("dhcp: create the statistics table only once")
Diffstat (limited to 'epan/dissectors/packet-dhcp.c')
-rw-r--r--epan/dissectors/packet-dhcp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-dhcp.c b/epan/dissectors/packet-dhcp.c
index 7467194d3e..f50854a4e6 100644
--- a/epan/dissectors/packet-dhcp.c
+++ b/epan/dissectors/packet-dhcp.c
@@ -7263,11 +7263,16 @@ static void dhcp_stat_init(stat_tap_table_ui* new_stat)
stat_tap_table_item_type items[sizeof(dhcp_stat_fields)/sizeof(stat_tap_table_item)];
table = stat_tap_find_table(new_stat, table_name);
- if (!table) {
- table = stat_tap_init_table(table_name, num_fields, 0, NULL);
- stat_tap_add_table(new_stat, table);
+ if (table) {
+ if (new_stat->stat_tap_reset_table_cb) {
+ new_stat->stat_tap_reset_table_cb(table);
+ }
+ return;
}
+ table = stat_tap_init_table(table_name, num_fields, 0, NULL);
+ stat_tap_add_table(new_stat, table);
+
/* Add a row for each value type */
while (opt53_text[i].strptr)
{