On Win32, if the attempt to open the capture device fails, don't talk

about checking permissions, as the capture devices are probably
available to all users, and talking about permissions will only confuse
the user.  Do, however, warn that Ethereal can't capture on Token Ring
or PPP/WAN interfaces.

On UNIX, if the attempt to open the capture device fails, and the error
message starts with "can't find PPA for ", they are probably running on
HP-UX with a version of libpcap not patched to properly look up PPAs for
network interfaces given the interface name; give them a detailed
warning about this, telling them that they'll have to fix libpcap and
build Ethereal from source, and pointing them at the "README.hpux" file.

svn path=/trunk/; revision=2265
This commit is contained in:
Guy Harris 2000-08-13 08:17:03 +00:00
parent e01997e3d0
commit 1c910d808a
2 changed files with 97 additions and 25 deletions

View File

@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
* $Id: capture.c,v 1.117 2000/08/11 13:34:41 deniel Exp $
* $Id: capture.c,v 1.118 2000/08/13 08:17:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -952,7 +952,11 @@ capture(void)
bpf_u_int32 netnum, netmask;
time_t upd_time, cur_time;
int err, inpkts;
char errmsg[1024+1];
char errmsg[4096+1];
#ifndef _WIN32
static const char ppamsg[] = "can't find PPA for ";
char *libpcap_warn;
#endif
fd_set set1;
struct timeval timeout;
#ifdef linux
@ -1002,7 +1006,29 @@ capture(void)
pch = pcap_open_live(cfile.iface, cfile.snap, 1, CAP_READ_TIMEOUT, err_str);
if (pch == NULL) {
#ifndef _WIN32
#ifdef _WIN32
/* Well, we couldn't start the capture.
If this is a child process that does the capturing in sync
mode or fork mode, it shouldn't do any UI stuff until we pop up the
capture-progress window, and, since we couldn't start the
capture, we haven't popped it up. */
if (!capture_child) {
while (gtk_events_pending()) gtk_main_iteration();
}
/* On Win32 OSes, the capture devices are probably available to all
users; don't warn about permissions problems.
Do, however, warn that Token Ring and PPP devices aren't supported. */
snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check that you have the proper interface specified.\n"
"\n"
"Note that the driver Ethereal uses for packet capture on Windows\n"
"doesn't support capturing on Token Ring or PPP/WAN interfaces.\n",
err_str);
goto error;
#else
/* try to open cfile.iface as a pipe */
pipe_fd = pipe_open_live(cfile.iface, &hdr, &ld, err_str);
@ -1015,26 +1041,36 @@ capture(void)
if (!capture_child) {
while (gtk_events_pending()) gtk_main_iteration();
}
/* If we got a "can't find PPA for XXX" message, warn the user (who
is running Ethereal on HP-UX) that they don't have a version
of libpcap patched to properly handle HP-UX (the patched version
says "can't find /dev/dlpi PPA for XXX" rather than "can't find
PPA for XXX"). */
if (strncmp(err_str, ppamsg, sizeof ppamsg - 1) == 0)
libpcap_warn =
"\n\n"
"You are running Ethereal with a version of the libpcap library\n"
"that doesn't handle HP-UX network devices well; this means that\n"
"Ethereal may not be able to capture packets.\n"
"\n"
"To fix this, you will need to download the source to Ethereal\n"
"from ethereal.zing.org if you have not already done so, read\n"
"the instructions in the \"README.hpux\" file in the source\n"
"distribution, download the source to libpcap if you have not\n"
"already done so, patch libpcap as per the instructions, rebuild\n"
"and install libpcap, and then build Ethereal (if you have already\n"
"built Ethereal from source, do a \"make distclean\" and re-run\n"
"configure before building).";
else
libpcap_warn = "";
snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check to make sure you have sufficient permissions, and that\n"
"you have the proper interface or pipe specified.", err_str);
"you have the proper interface or pipe specified.%s", err_str,
libpcap_warn);
goto error;
}
#else
/* Well, we couldn't start the capture.
If this is a child process that does the capturing in sync
mode or fork mode, it shouldn't do any UI stuff until we pop up the
capture-progress window, and, since we couldn't start the
capture, we haven't popped it up. */
if (!capture_child) {
while (gtk_events_pending()) gtk_main_iteration();
}
snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check to make sure you have sufficient permissions, and that\n"
"you have the proper interface specified.", err_str);
goto error;
#endif
}

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.39 2000/08/11 13:34:49 deniel Exp $
* $Id: tethereal.c,v 1.40 2000/08/13 08:17:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -514,6 +514,10 @@ capture(int packet_count, int out_file_type)
void (*oldhandler)(int);
int err, inpkts;
char errmsg[1024+1];
#ifndef _WIN32
static const char ppamsg[] = "can't find PPA for ";
char *libpcap_warn;
#endif
/* Initialize the table of conversations. */
conversation_init();
@ -528,15 +532,47 @@ capture(int packet_count, int out_file_type)
ld.pch = pcap_open_live(cfile.iface, cfile.snap, 1, 1000, err_str);
if (ld.pch == NULL) {
/* Well, we couldn't start the capture.
If this is a child process that does the capturing in sync
mode or fork mode, it shouldn't do any UI stuff until we pop up the
capture-progress window, and, since we couldn't start the
capture, we haven't popped it up. */
/* Well, we couldn't start the capture. */
#ifdef _WIN32
/* On Win32 OSes, the capture devices are probably available to all
users; don't warn about permissions problems.
Do, however, warn that Token Ring and PPP devices aren't supported. */
snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check that you have the proper interface specified.\n"
"\n"
"Note that the driver Ethereal uses for packet capture on Windows\n"
"doesn't support capturing on Token Ring or PPP/WAN interfaces.\n",
err_str);
#else
/* If we got a "can't find PPA for XXX" message, warn the user (who
is running Ethereal on HP-UX) that they don't have a version
of libpcap patched to properly handle HP-UX (the patched version
says "can't find /dev/dlpi PPA for XXX" rather than "can't find
PPA for XXX"). */
if (strncmp(err_str, ppamsg, sizeof ppamsg - 1) == 0)
libpcap_warn =
"\n\n"
"You are running Ethereal with a version of the libpcap library\n"
"that doesn't handle HP-UX network devices well; this means that\n"
"Ethereal may not be able to capture packets.\n"
"\n"
"To fix this, you will need to download the source to Ethereal\n"
"from ethereal.zing.org if you have not already done so, read\n"
"the instructions in the \"README.hpux\" file in the source\n"
"distribution, download the source to libpcap if you have not\n"
"already done so, patch libpcap as per the instructions, rebuild\n"
"and install libpcap, and then build Ethereal (if you have already\n"
"built Ethereal from source, do a \"make distclean\" and re-run\n"
"configure before building).";
else
libpcap_warn = "";
snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check to make sure you have sufficient permissions, and that\n"
"you have the proper interface specified.", err_str);
"you have the proper interface specified.%s", err_str, libpcap_warn);
#endif
goto error;
}