aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2007-09-15 00:18:17 +0000
committerGerald Combs <gerald@wireshark.org>2007-09-15 00:18:17 +0000
commitd2d4fcd903f3c675d85a4d32bff280f4a5bc8e6e (patch)
tree88cf3b0551436062acb26b33f60dd27417944d81 /tshark.c
parentd0c2725672061a344852cc3f7473e36826522638 (diff)
Add routines under Windows to check if npf.sys is running, and to
fetch the major OS version. If we're running Windows >= 6 (Vista) _and_ npf.sys isn't running, warn the user in Wireshark and TShark. Add a recent prefs item to disable the warning in Wireshark. svn path=/trunk/; revision=22877
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tshark.c b/tshark.c
index e9931a3beb..80096d35be 100644
--- a/tshark.c
+++ b/tshark.c
@@ -686,6 +686,17 @@ print_current_user() {
}
}
+static void
+check_npf_sys() {
+#ifdef _WIN32
+ /* Warn the user if npf.sys isn't loaded. */
+ if (!npf_sys_is_running() && get_os_major_version() >= 6) {
+ fprintf(stderr, "The NPF driver isn't running. You may have trouble "
+ "capturing or\nlisting interfaces.\n");
+ }
+#endif
+}
+
int
@@ -966,6 +977,7 @@ main(int argc, char *argv[])
break;
case 'D': /* Print a list of capture devices and exit */
#ifdef HAVE_LIBPCAP
+ check_npf_sys();
status = capture_opts_list_interfaces(FALSE);
exit(status);
#else
@@ -1542,6 +1554,7 @@ main(int argc, char *argv[])
/* if requested, list the link layer types and exit */
if (list_link_layer_types) {
+ check_npf_sys();
status = capture_opts_list_link_layer_types(&capture_opts, FALSE);
exit(status);
}
@@ -1632,6 +1645,8 @@ capture(void)
ld.packet_cb = capture_pcap_cb;
+ check_npf_sys();
+
/* open the "input file" from network interface or capture pipe */
if (!capture_loop_open_input(&capture_opts, &ld, errmsg, sizeof(errmsg),
secondary_errmsg, sizeof(secondary_errmsg))) {