aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/tshark.pod2
-rw-r--r--test/suite_clopts.py69
-rw-r--r--ui/cli/tap-expert.c12
3 files changed, 80 insertions, 3 deletions
diff --git a/doc/tshark.pod b/doc/tshark.pod
index b3e0924b74..ac60b27301 100644
--- a/doc/tshark.pod
+++ b/doc/tshark.pod
@@ -1178,7 +1178,7 @@ the number of packets/bytes in each direction as well as the total
number of packets/bytes. The table is sorted according to the total
number of frames.
-=item B<-z> expert[I<,error|,warn|,note|,chat>][I<,filter>]
+=item B<-z> expert[I<,error|,warn|,note|,chat|,comment>][I<,filter>]
Collects information about all expert info, and will display them in order,
grouped by severity.
diff --git a/test/suite_clopts.py b/test/suite_clopts.py
index aa6ec95ccc..98981ad8ca 100644
--- a/test/suite_clopts.py
+++ b/test/suite_clopts.py
@@ -192,6 +192,75 @@ class case_tshark_dump_glossaries(subprocesstest.SubprocessTestCase):
self.runProcess((config.cmd_tshark, '-G', 'plugins'), env=config.baseEnv())
self.assertGreaterEqual(self.countOutput('dissector'), 10, 'Fewer than 10 dissector plugins found')
+class case_tshark_z_expert(subprocesstest.SubprocessTestCase):
+ def test_tshark_z_expert_all(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_error(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_warn(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,warn',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_note(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,note',
+ '-r', os.path.join(config.capture_dir, 'http2-data-reassembly.pcap')))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Notes'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_chat(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,chat',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_comment(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,comment',
+ '-r', os.path.join(config.capture_dir, 'sip.pcapng')))
+ self.assertTrue(self.grepOutput('Notes'))
+ self.assertTrue(self.grepOutput('Comments'))
+
+ def test_tshark_z_expert_invalid_filter(self):
+ invalid_filter = '__invalid_protocol'
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,' + invalid_filter,
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')),
+ expected_return=self.exit_command_line)
+ self.assertTrue(self.grepOutput('Filter "' + invalid_filter + '" is invalid'))
+
+ def test_tshark_z_expert_error_invalid_filter(self):
+ invalid_filter = '__invalid_protocol'
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error,' + invalid_filter,
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')),
+ expected_return=self.exit_command_line)
+ self.assertTrue(self.grepOutput('Filter "' + invalid_filter + '" is invalid'))
+
+ def test_tshark_z_expert_filter(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,udp', #udp is a filter
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertFalse(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_error_filter(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error,udp', #udp is a filter
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertFalse(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
# Purposefully fail a test. Used for testing the test framework.
# class case_fail_on_purpose(subprocesstest.SubprocessTestCase):
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c
index 21622abaa3..3dc33aae2c 100644
--- a/ui/cli/tap-expert.c
+++ b/ui/cli/tap-expert.c
@@ -24,7 +24,8 @@ void register_tap_listener_expert_info(void);
/* Tap data */
typedef enum severity_level_t {
- chat_level = 0,
+ comment_level = 0,
+ chat_level,
note_level,
warn_level,
error_level,
@@ -33,7 +34,7 @@ typedef enum severity_level_t {
/* This variable stores the lowest level that will be displayed.
May be changed from the command line */
-static severity_level_t lowest_report_level = chat_level;
+static severity_level_t lowest_report_level = comment_level;
typedef struct expert_entry
{
@@ -81,6 +82,9 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U
guint n;
switch (ei->severity) {
+ case PI_COMMENT:
+ severity_level = comment_level;
+ break;
case PI_CHAT:
severity_level = chat_level;
break;
@@ -176,6 +180,7 @@ expert_stat_draw(void *phs _U_)
draw_items_for_severity(hs->ei_array[warn_level], "Warns");
draw_items_for_severity(hs->ei_array[note_level], "Notes");
draw_items_for_severity(hs->ei_array[chat_level], "Chats");
+ draw_items_for_severity(hs->ei_array[comment_level], "Comments");
}
static void
@@ -222,6 +227,9 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_)
} else if (g_ascii_strncasecmp(args, ",chat", 5) == 0) {
lowest_report_level = chat_level;
args += 5;
+ } else if (g_ascii_strncasecmp(args, ",comment", 8) == 0) {
+ lowest_report_level = comment_level;
+ args += 8;
}
}