Report the correct interface when there is a problem with a capture filter.

This patch is from Irene Ruengeler.

svn path=/trunk/; revision=37804
This commit is contained in:
Michael Tüxen 2011-06-27 12:13:15 +00:00
parent 043ea23beb
commit 4bc67de4ea
2 changed files with 14 additions and 6 deletions

View 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;

View File

@ -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,