aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/decode_as_dlg.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-09-16 23:58:49 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-09-19 09:28:18 +0000
commit1d7bcb28f9d12a8da68b9af5517478c8968da9cc (patch)
tree3763be614a85502eacc2a01c9afda9957e97cde5 /ui/gtk/decode_as_dlg.c
parent608029b3313cdf3185e829e2415cda4f0bcc17bf (diff)
Fix 'Decode As' when used with IPv6-in-IPv6 packets
Add the ability to identify an instance of the dissector table to be modified by 'Decode As' thanks to pinfo->curr_layer_num For now only IPv6 makes use of it but it could be extended to any other protocol Also get rid of ipv6.nxt protocol: it is not required for 'Decode As' functionality and was colliding with ipv6.nxt field Change-Id: I3c7403c77328ad7170e13af028d178f962a2b508 Reviewed-on: https://code.wireshark.org/review/10552 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'ui/gtk/decode_as_dlg.c')
-rw-r--r--ui/gtk/decode_as_dlg.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/gtk/decode_as_dlg.c b/ui/gtk/decode_as_dlg.c
index e85fb74a6d..b752c4bb95 100644
--- a/ui/gtk/decode_as_dlg.c
+++ b/ui/gtk/decode_as_dlg.c
@@ -79,10 +79,11 @@
#define E_LIST_S_MAX E_LIST_S_TABLE
#define E_LIST_S_COLUMNS (E_LIST_S_MAX + 1)
-#define E_PAGE_LIST "notebook_page_list"
-#define E_PAGE_TABLE "notebook_page_table_name"
-#define E_PAGE_TITLE "notebook_page_title"
-#define E_PAGE_VALUE "notebook_page_value"
+#define E_PAGE_LIST "notebook_page_list"
+#define E_PAGE_TABLE "notebook_page_table_name"
+#define E_PAGE_TITLE "notebook_page_title"
+#define E_PAGE_VALUE "notebook_page_value"
+#define E_PAGE_CURR_LAYER_NUM "notebook_page_curr_layer_num"
#define E_PAGE_ACTION "notebook_page_action"
@@ -671,12 +672,15 @@ decode_simple (GtkWidget *notebook_pg)
/* Apply values to dissector table (stored in entry) */
for (value_loop = 0; value_loop < entry->values[requested_index].num_values; value_loop++)
{
+ guint8 saved_curr_layer_num = cfile.edt->pi.curr_layer_num;
+ cfile.edt->pi.curr_layer_num = (guint8)GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(notebook_pg), E_PAGE_CURR_LAYER_NUM));
value_ptr = entry->values[requested_index].build_values[value_loop](&cfile.edt->pi);
if (abbrev != NULL && strcmp(abbrev, "(default)") == 0) {
add_reset_list = entry->reset_value(table_name, value_ptr);
} else {
add_reset_list = entry->change_value(table_name, value_ptr, &handle, abbrev);
}
+ cfile.edt->pi.curr_layer_num = saved_curr_layer_num;
if (add_reset_list) {
selector_type = g_new(guint,1);
@@ -1214,6 +1218,7 @@ decode_add_simple_page (decode_as_t *entry)
if (entry->num_items == 1)
{
g_object_set_data(G_OBJECT(page), E_PAGE_VALUE, entry->values[0].build_values[0](&cfile.edt->pi));
+ g_object_set_data(G_OBJECT(page), E_PAGE_CURR_LAYER_NUM, GUINT_TO_POINTER(cfile.edt->pi.curr_layer_num));
/* Always enabled */
entry->values->label_func(&cfile.edt->pi, prompt);
@@ -1303,6 +1308,9 @@ decode_add_notebook (GtkWidget *format_hb)
const char* proto_name;
GList *list_entry;
decode_as_t *entry;
+ guint8 saved_curr_layer_num = cfile.edt->pi.curr_layer_num;
+
+ cfile.edt->pi.curr_layer_num = 1;
/* Start a nootbook for flipping between sets of changes */
notebook = gtk_notebook_new();
@@ -1332,8 +1340,11 @@ decode_add_notebook (GtkWidget *format_hb)
}
protos = wmem_list_frame_next(protos);
+ cfile.edt->pi.curr_layer_num++;
}
+ cfile.edt->pi.curr_layer_num = saved_curr_layer_num;
+
/* Select the last added page (selects first by default) */
/* Notebook must be visible for set_page to work. */
gtk_widget_show_all(notebook);