On Windows, if "get_interface_list()" returns CANT_GET_INTERFACE_LIST
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 12 Jun 2004 07:47:14 +0000 (07:47 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 12 Jun 2004 07:47:14 +0000 (07:47 +0000)
and the error message includes "Not enough storage is available
to process this command" or "The operation completed successfully",
suggest that the user install a WinPcap version later than 3.0 - this is
definitely a Frequently Asked Question on the Ethereal list.

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

capture-wpcap.c
gtk/capture_dlg.c
gtk/capture_prefs.c
gtk/main.c
pcap-util-unix.c
pcap-util.h
tethereal.c

index 53225ae889a24b4d6be43167d9d6f64ff4096bfa..50e86fb92fff5e933c4e75ed8bdc2ff6f7388e52 100644 (file)
@@ -3,7 +3,7 @@
  * time, so that we only need one Ethereal binary and one Tethereal binary
  * for Windows, regardless of whether WinPcap is installed or not.
  *
  * time, so that we only need one Ethereal binary and one Tethereal binary
  * for Windows, regardless of whether WinPcap is installed or not.
  *
- * $Id: capture-wpcap.c,v 1.9 2004/03/13 22:49:29 ulfl Exp $
+ * $Id: capture-wpcap.c,v 1.10 2004/06/12 07:47:12 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -411,6 +411,28 @@ get_interface_list(int *err, char *err_str)
        return il;
 }
 
        return il;
 }
 
+/*
+ * Get an error message string for a CANT_GET_INTERFACE_LIST error from
+ * "get_interface_list()".
+ */
+gchar *
+cant_get_if_list_error_message(const char *err_str)
+{
+       /*
+        * If the error message includes "Not enough storage is available
+        * to process this command" or "The operation completed successfully",
+        * suggest that they install a WinPcap version later than 3.0.
+        */
+       if (strstr(err_str, "Not enough storage is available to process this command") != NULL ||
+           strstr(err_str, "The operation completed successfully") != NULL) {
+               return g_strdup_printf("Can't get list of interfaces: %s\n"
+"This might be a problem with WinPcap 3.0; you should try updating to\n"
+"a later version of WinPcap - see the WinPcap site at winpcap.polito.it",
+                   err_str);
+       }
+       return g_strdup_printf("Can't get list of interfaces: %s", err_str);
+}
+
 /*
  * Append the version of WinPcap with which we were compiled to a GString.
  */
 /*
  * Append the version of WinPcap with which we were compiled to a GString.
  */
index 76781abfc18a9bc197a438722caecc73da5198d8..1785f74fc5d908a8fc663ce13de2bb3d14a9258d 100644 (file)
@@ -1,7 +1,7 @@
 /* capture_dlg.c
  * Routines for packet capture windows
  *
 /* capture_dlg.c
  * Routines for packet capture windows
  *
- * $Id: capture_dlg.c,v 1.132 2004/05/26 04:21:48 guy Exp $
+ * $Id: capture_dlg.c,v 1.133 2004/06/12 07:47:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -478,6 +478,7 @@ capture_prep(void)
   int           err;
   int           row;
   char          err_str[PCAP_ERRBUF_SIZE];
   int           err;
   int           row;
   char          err_str[PCAP_ERRBUF_SIZE];
+  gchar         *cant_get_if_list_errstr;
 #ifdef _WIN32
   GtkAdjustment *buffer_size_adj;
   GtkWidget     *buffer_size_lb, *buffer_size_sb;
 #ifdef _WIN32
   GtkAdjustment *buffer_size_adj;
   GtkWidget     *buffer_size_lb, *buffer_size_sb;
@@ -515,8 +516,10 @@ capture_prep(void)
 
   if_list = get_interface_list(&err, err_str);
   if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
 
   if_list = get_interface_list(&err, err_str);
   if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
-    simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Can't get list of interfaces: %s",
-                       err_str);
+    cant_get_if_list_errstr = cant_get_if_list_error_message(err_str);
+    simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
+                  cant_get_if_list_errstr);
+    g_free(cant_get_if_list_errstr);
   }
 
   cap_open_w = dlg_window_new("Ethereal: Capture Options");
   }
 
   cap_open_w = dlg_window_new("Ethereal: Capture Options");
index 044736c4fc91424204b1f1c41904244a877973e5..53cf3df463b1c178aa9205f35806d44cdf6ae153 100644 (file)
@@ -1,7 +1,7 @@
 /* capture_prefs.c
  * Dialog box for capture preferences
  *
 /* capture_prefs.c
  * Dialog box for capture preferences
  *
- * $Id: capture_prefs.c,v 1.36 2004/05/31 11:22:58 ulfl Exp $
+ * $Id: capture_prefs.c,v 1.37 2004/06/12 07:47:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -664,16 +664,20 @@ static void
 ifopts_if_clist_add(void)
 {
        GList           *if_list;
 ifopts_if_clist_add(void)
 {
        GList           *if_list;
-       int                     err;
+       int             err;
        char            err_str[PCAP_ERRBUF_SIZE];
        char            err_str[PCAP_ERRBUF_SIZE];
+       gchar           *cant_get_if_list_errstr;
        if_info_t       *if_info;
        guint           i;
        guint           nitems;
        
        if_list = get_interface_list(&err, err_str);
        if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
        if_info_t       *if_info;
        guint           i;
        guint           nitems;
        
        if_list = get_interface_list(&err, err_str);
        if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
-               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                               "Can't get list of interfaces: %s", err_str);
+               cant_get_if_list_errstr =
+                   cant_get_if_list_error_message(err_str);
+               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
+                   cant_get_if_list_errstr);
+               g_free(cant_get_if_list_errstr);
                return;
        }
        
                return;
        }
        
index 5b073643fcee80d055b9499866eaec4369708994..2e6dcfb3e599223fd82e4bb347a0ad3e28c07599 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
 /* main.c
  *
- * $Id: main.c,v 1.440 2004/06/01 17:33:36 ulfl Exp $
+ * $Id: main.c,v 1.441 2004/06/12 07:47:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1551,6 +1551,7 @@ main(int argc, char *argv[])
   GList               *lt_list, *lt_entry;
   data_link_info_t    *data_link_info;
   gchar                err_str[PCAP_ERRBUF_SIZE];
   GList               *lt_list, *lt_entry;
   data_link_info_t    *data_link_info;
   gchar                err_str[PCAP_ERRBUF_SIZE];
+  gchar               *cant_get_if_list_errstr;
   gboolean             stats_known;
   struct pcap_stat     stats;
 #else
   gboolean             stats_known;
   struct pcap_stat     stats;
 #else
@@ -2227,8 +2228,9 @@ main(int argc, char *argv[])
           switch (err) {
 
           case CANT_GET_INTERFACE_LIST:
           switch (err) {
 
           case CANT_GET_INTERFACE_LIST:
-              fprintf(stderr, "ethereal: Can't get list of interfaces: %s\n",
-                       err_str);
+              cant_get_if_list_errstr = cant_get_if_list_error_message(err_str);
+              fprintf(stderr, "%s\n", cant_get_if_list_errstr);
+              g_free(cant_get_if_list_errstr);
               break;
 
           case NO_INTERFACES_FOUND:
               break;
 
           case NO_INTERFACES_FOUND:
index 29015769b68cfa5be05df1568c932855ee8257f3..d0b4c0ec412dfacea01418c336b24b99a71d7f10 100644 (file)
@@ -1,7 +1,7 @@
 /* pcap-util-unix.c
  * UN*X-specific utility routines for packet capture
  *
 /* pcap-util-unix.c
  * UN*X-specific utility routines for packet capture
  *
- * $Id: pcap-util-unix.c,v 1.2 2003/10/10 06:05:48 guy Exp $
+ * $Id: pcap-util-unix.c,v 1.3 2004/06/12 07:47:13 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -270,6 +270,16 @@ search_for_if_cb(gpointer data, gpointer user_data)
 }
 #endif /* HAVE_PCAP_FINDALLDEVS */
 
 }
 #endif /* HAVE_PCAP_FINDALLDEVS */
 
+/*
+ * Get an error message string for a CANT_GET_INTERFACE_LIST error from
+ * "get_interface_list()".
+ */
+gchar *
+cant_get_if_list_error_message(const char *err_str)
+{
+       return g_strdup_printf("Can't get list of interfaces: %s", err_str);
+}
+
 /*
  * Append the version of libpcap with which we were compiled to a GString.
  */
 /*
  * Append the version of libpcap with which we were compiled to a GString.
  */
index 638454840d11ad59320be01666482fee8b6866d9..56bdc2cae3ed2c4b4a44cfac6ec2b78f96a3ff6e 100644 (file)
@@ -1,7 +1,7 @@
 /* pcap-util.h
  * Utility definitions for packet capture
  *
 /* pcap-util.h
  * Utility definitions for packet capture
  *
- * $Id: pcap-util.h,v 1.6 2003/11/01 02:30:14 guy Exp $
+ * $Id: pcap-util.h,v 1.7 2004/06/12 07:47:13 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -60,6 +60,12 @@ GList *get_interface_list(int *err, char *err_str);
 
 void free_interface_list(GList *if_list);
 
 
 void free_interface_list(GList *if_list);
 
+/*
+ * Get an error message string for a CANT_GET_INTERFACE_LIST error from
+ * "get_interface_list()".
+ */
+gchar *cant_get_if_list_error_message(const char *err_str);
+
 /*
  * The list of data link types returned by "get_pcap_linktype_list()" is
  * a list of these structures.
 /*
  * The list of data link types returned by "get_pcap_linktype_list()" is
  * a list of these structures.
index ddf36848d29c20da8bf4d6a8021d1813e4650505..3c5c7ee82c6ddbbe2b72a8615beb01e0ac4e2c69 100644 (file)
@@ -1,6 +1,6 @@
 /* tethereal.c
  *
 /* tethereal.c
  *
- * $Id: tethereal.c,v 1.243 2004/06/10 08:01:51 guy Exp $
+ * $Id: tethereal.c,v 1.244 2004/06/12 07:47:13 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -816,6 +816,7 @@ main(int argc, char *argv[])
   long                 adapter_index;
   char                *p;
   gchar                err_str[PCAP_ERRBUF_SIZE];
   long                 adapter_index;
   char                *p;
   gchar                err_str[PCAP_ERRBUF_SIZE];
+  gchar               *cant_get_if_list_errstr;
 #else
   gboolean             capture_option_specified = FALSE;
 #endif
 #else
   gboolean             capture_option_specified = FALSE;
 #endif
@@ -1000,8 +1001,10 @@ main(int argc, char *argv[])
             switch (err) {
 
             case CANT_GET_INTERFACE_LIST:
             switch (err) {
 
             case CANT_GET_INTERFACE_LIST:
-                fprintf(stderr, "tethereal: Can't get list of interfaces: %s\n",
-                       err_str);
+                cant_get_if_list_errstr =
+                    cant_get_if_list_error_message(err_str);
+                fprintf(stderr, "tethereal: %s\n", cant_get_if_list_errstr);
+                g_free(cant_get_if_list_errstr);
                 break;
 
             case NO_INTERFACES_FOUND:
                 break;
 
             case NO_INTERFACES_FOUND:
@@ -1081,8 +1084,10 @@ main(int argc, char *argv[])
             switch (err) {
 
             case CANT_GET_INTERFACE_LIST:
             switch (err) {
 
             case CANT_GET_INTERFACE_LIST:
-                fprintf(stderr, "tethereal: Can't get list of interfaces: %s\n",
-                        err_str);
+                cant_get_if_list_errstr =
+                    cant_get_if_list_error_message(err_str);
+                fprintf(stderr, "tethereal: %s\n", cant_get_if_list_errstr);
+                g_free(cant_get_if_list_errstr);
                 break;
 
             case NO_INTERFACES_FOUND:
                 break;
 
             case NO_INTERFACES_FOUND:
@@ -1567,8 +1572,10 @@ main(int argc, char *argv[])
                 switch (err) {
 
                 case CANT_GET_INTERFACE_LIST:
                 switch (err) {
 
                 case CANT_GET_INTERFACE_LIST:
-                    fprintf(stderr, "tethereal: Can't get list of interfaces: %s\n",
-                           err_str);
+                    cant_get_if_list_errstr =
+                        cant_get_if_list_error_message(err_str);
+                    fprintf(stderr, "tethereal: %s\n", cant_get_if_list_errstr);
+                    g_free(cant_get_if_list_errstr);
                     break;
 
                 case NO_INTERFACES_FOUND:
                     break;
 
                 case NO_INTERFACES_FOUND: