Report the correct interface when there is a problem with a capture filter.
authortuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jun 2011 12:13:15 +0000 (12:13 +0000)
committertuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jun 2011 12:13:15 +0000 (12:13 +0000)
This patch is from Irene Ruengeler.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37804 f5534014-38df-0310-8fa8-9805f1628bb7

capture_sync.c
dumpcap.c

index fbc374bc39c9110fd94913d0807dc564fec54b41..310c9179945237930bb01f7dc6db3304792cfe01 100644 (file)
@@ -1623,11 +1623,17 @@ sync_pipe_input_cb(gint source, gpointer user_data)
         /* the capture child will close the sync_pipe, nothing to do for now */
         /* (an error message doesn't mean we have to stop capturing) */
         break;
-    case SP_BAD_FILTER:
-        /* FIXME: Indicate the correct index */
-        capture_input_cfilter_error_message(capture_opts, 0, buffer);
-        /* the capture child will close the sync_pipe, nothing to do for now */
-        break;
+    case SP_BAD_FILTER: {
+        char *ch;
+        int index;
+
+        ch = strtok(buffer, ":");
+        index = (int)strtol(ch, NULL, 10);
+        ch = strtok(NULL, ":");
+        capture_input_cfilter_error_message(capture_opts, index, ch);
+         /* the capture child will close the sync_pipe, nothing to do for now */
+         break;
+        }
     case SP_DROPS:
         capture_input_drops(capture_opts, (guint32)strtoul(buffer, NULL, 10));
         break;
index ae54145f265a4ef2c6b7a60e6ece50b20ef6bda1..da02aa6fceba25985814092dad663e0e8f1444ed 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4408,11 +4408,13 @@ static void
 report_cfilter_error(capture_options *capture_opts, guint i, const char *errmsg)
 {
     interface_options interface_opts;
+    char tmp[MSG_MAX_LENGTH+1+6];
 
     if (i < capture_opts->ifaces->len) {
         if (capture_child) {
+            g_snprintf(tmp, sizeof(tmp), "%u:%s", i, errmsg);
             g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Capture filter error: %s", errmsg);
-            pipe_write_block(2, SP_BAD_FILTER, errmsg);
+            pipe_write_block(2, SP_BAD_FILTER, tmp);
         } else {
             interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
             fprintf(stderr,