From jmmikkel@mit.edu (Bug 2895):
authorSake Blok <sake@euronet.nl>
Tue, 30 Sep 2008 15:45:20 +0000 (15:45 -0000)
committerSake Blok <sake@euronet.nl>
Tue, 30 Sep 2008 15:45:20 +0000 (15:45 -0000)
We might receive new packets while redissecting and don't want to
dissect those before the packet-list is fully rebuilt.

svn path=/trunk/; revision=26309

cfile.c
cfile.h
file.c

diff --git a/cfile.c b/cfile.c
index 8ad55160f7887a3e817002e2a8df45a5e2e997f7..aa218e607b26cf44a7ba8e23480fe2ad93bf0a07 100644 (file)
--- a/cfile.c
+++ b/cfile.c
@@ -55,4 +55,5 @@ init_cap_file(capture_file *cf)
   cf->snap             = WTAP_MAX_PACKET_SIZE;
   cf->count            = 0;
   cf->pstats           = NULL;
+  cf->redissecting     = FALSE;
 }
diff --git a/cfile.h b/cfile.h
index a5b154158db40f8f577f5d6e1458821497e038c7..138609dcdeccfac563100d7c4c8aafb438138e6b 100644 (file)
--- a/cfile.h
+++ b/cfile.h
@@ -61,6 +61,7 @@ typedef struct _capture_file {
   wtap        *wth;       /* Wiretap session */
   dfilter_t   *rfcode;    /* Compiled read (display) filter program */
   gchar       *dfilter;   /* Display filter string */
+  gboolean     redissecting; /* TRUE if currently redissecting (cf_redissect_packets) */
   /* search */
   gchar       *sfilter;   /* Search filter string */
   gboolean     sbackward; /* TRUE if search is backward, FALSE if forward */
diff --git a/file.c b/file.c
index 1ecbae107ea47b8ddc92234e80073bfc136ba620..f4415cdd0a117f9cb1d5836c7dbaed12ec728d1c 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1122,7 +1122,9 @@ read_packet(capture_file *cf, dfilter_t *dfcode, gint64 offset)
     cf->count++;
     cf->f_datalen = offset + phdr->caplen;
     fdata->num = cf->count;
-    row = add_packet_to_packet_list(fdata, cf, dfcode, pseudo_header, buf, TRUE);
+    if (!cf->redissecting) {
+      row = add_packet_to_packet_list(fdata, cf, dfcode, pseudo_header, buf, TRUE);
+    }
   } else {
     /* XXX - if we didn't have read filters, or if we could avoid
        allocating the "frame_data" structure until we knew whether
@@ -1515,6 +1517,10 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
        which might cause the state information to be constructed differently
        by that dissector. */
 
+    /* We might receive new packets while redissecting, and we don't
+       want to dissect those before their time. */
+    cf->redissecting = TRUE;
+
     /* Initialize all data structures used for dissection. */
     init_dissection();
   }
@@ -1661,6 +1667,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
     prev_frame = fdata;
   }
 
+  /* We are done redissecting the packet list. */
+  cf->redissecting = FALSE;
+
   /* Re-sort the list using the previously selected order */
   packet_list_set_sort_column();