Just check for pcap_create(); it first appeared in libpcap 1.0.0, and
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 6 May 2010 23:33:41 +0000 (23:33 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 6 May 2010 23:33:41 +0000 (23:33 +0000)
pcap_set_buffer_size() did as well, so there aren't any libpcap releases
with pcap_create() but not pcap_set_buffer_size().

Only do one check for pcap_create.

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

acinclude.m4
capture_opts.c
capture_opts.h
capture_sync.c
dumpcap.c
gtk/capture_dlg.c
gtk/main.c
tshark.c

index dedbe25ff4985c997ae83929b8187c524e52972f..5eb2359a075c94a6134976731609b807afb3f2f8 100644 (file)
@@ -513,9 +513,6 @@ and did you also install that package?]]))
                AC_MSG_RESULT(no)
        fi
        AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
-# Don't activate this check yet 
-# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475      
-#      AC_CHECK_FUNCS(pcap_create pcap_set_buffer_size)
        #
        # pcap_breakloop may be present in the library but not declared
        # in the pcap.h header file.  If it's not declared in the header
index 48d1f3733519b12e34eb51dc0edee1710eecca7f..d06081023493438a7ab00a0eccbb82c8d017dd2d 100644 (file)
@@ -97,7 +97,7 @@ capture_opts_init(capture_options *capture_opts, void *cf)
   capture_opts->sampling_param          = 0;
 #endif
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   capture_opts->buffer_size             = 1;                /* 1 MB */
 #endif
   capture_opts->has_snaplen             = FALSE;
@@ -173,7 +173,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
     g_log(log_domain, log_level, "No capture RPCAP   : %u", capture_opts->nocap_rpcap);
     g_log(log_domain, log_level, "No capture local   : %u", capture_opts->nocap_local);
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     g_log(log_domain, log_level, "BufferSize         : %u (MB)", capture_opts->buffer_size);
 #endif
     g_log(log_domain, log_level, "SnapLen         (%u): %u", capture_opts->has_snaplen, capture_opts->snaplen);
@@ -464,7 +464,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
           return 1;
         }
         break;
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     case 'B':        /* Buffer size */
         capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size");
         break;
index 507ced2926c1e39b6da6dcf7c13ae66f24c85d5a..fa9bf6d6418d341a2c6838772d2b600e2192030e 100644 (file)
@@ -105,7 +105,7 @@ typedef struct capture_options_tag {
     int sampling_param;             /**< PCAP packet sampling parameter */
 #endif
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     int      buffer_size;           /**< the capture buffer size (MB) */
 #endif
     gboolean has_snaplen;           /**< TRUE if maximum capture packet length
index 55ff2bd121d41861990825253f2f519a6f331508..ab14c985586f39eeb71875d7fc6ac0577bdb0300 100644 (file)
@@ -257,7 +257,7 @@ sync_pipe_start(capture_options *capture_opts) {
 #ifdef HAVE_PCAP_SETSAMPLING
     char ssampling[ARGV_NUMBER_LEN];
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     char buffer_size[ARGV_NUMBER_LEN];
 #endif
 #ifdef _WIN32
@@ -398,7 +398,7 @@ sync_pipe_start(capture_options *capture_opts) {
 #endif
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     argv = sync_pipe_add_arg(argv, &argc, "-B");
 #ifdef HAVE_PCAP_REMOTE
     if (capture_opts->src_type == CAPTURE_IFREMOTE)
index a31448314442d209300d85b238ccdd5a3c9d54c2..aff5cbc5563d71b3036b3f9a6c600576d9da96dc 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -322,7 +322,7 @@ print_usage(gboolean print_ver) {
   fprintf(output, "  -f <capture filter>      packet filter in libpcap filter syntax\n");
   fprintf(output, "  -s <snaplen>             packet snapshot length (def: 65535)\n");
   fprintf(output, "  -p                       don't capture in promiscuous mode\n");
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   fprintf(output, "  -B <buffer size>         size of kernel buffer (def: 1MB)\n");
 #endif
   fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -1483,11 +1483,9 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
       pcap_set_promisc(ld->pcap_h, capture_opts->promisc_mode);
       pcap_set_timeout(ld->pcap_h, CAP_READ_TIMEOUT);
 
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
       if (capture_opts->buffer_size > 1) {
         pcap_set_buffer_size(ld->pcap_h, capture_opts->buffer_size * 1024 * 1024);
       }
-#endif
       if (pcap_activate(ld->pcap_h) != 0) {
         /* Failed to activate, set to NULL */
         pcap_close(ld->pcap_h);
@@ -2705,11 +2703,11 @@ main(int argc, char *argv[])
 #define OPTSTRING_INIT "a:b:c:Df:hi:LMnpSs:vw:y:Z:"
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
 #define OPTSTRING_EXTRA "B:"
 #else
 #define OPTSTRING_EXTRA ""
-#endif  /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
+#endif  /* _WIN32 or HAVE_PCAP_CREATE */
 
   char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_EXTRA) - 1] =
     OPTSTRING_INIT OPTSTRING_EXTRA;
@@ -2979,9 +2977,9 @@ main(int argc, char *argv[])
 #ifdef HAVE_PCAP_SETSAMPLING
       case 'm':        /* Sampling */
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
       case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
+#endif /* _WIN32 or HAVE_PCAP_CREATE */
         status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
         if(status != 0) {
           exit_main(status);
index d9b4e3bc224a12977ab30988f75ee93c25de3384..a6831a88dff0315bd1a45e5ecabdc4a29c52c246 100644 (file)
@@ -85,7 +85,7 @@
 #define E_CAP_SNAP_CB_KEY               "cap_snap_cb"
 #define E_CAP_LT_OM_KEY                 "cap_lt_om"
 #define E_CAP_LT_OM_LABEL_KEY           "cap_lt_om_label"
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
 #define E_CAP_BUFFER_SIZE_SB_KEY        "cap_buffer_size_sb"
 #endif
 #define E_CAP_SNAP_SB_KEY               "cap_snap_sb"
@@ -1471,7 +1471,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
   int           row;
   int           err;
   gchar         *err_str;
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   GtkAdjustment *buffer_size_adj;
   GtkWidget     *buffer_size_lb, *buffer_size_sb, *buffer_size_hb;
 #endif
@@ -1658,7 +1658,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
   gtk_container_set_border_width(GTK_CONTAINER(left_vb), 0);
   gtk_box_pack_start(GTK_BOX(main_hb), left_vb, TRUE, TRUE, 0);
 
-#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined (HAVE_AIRPCAP) || defined (HAVE_PCAP_REMOTE) || defined (HAVE_PCAP_CREATE)
   /* Avoid adding the right vbox if not needed, because it steals 3 pixels */
   right_vb = gtk_vbox_new(FALSE, 3);
   gtk_container_set_border_width(GTK_CONTAINER(right_vb), 0);
@@ -1820,7 +1820,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
   gtk_widget_show(remote_bt);
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   buffer_size_hb = gtk_hbox_new(FALSE, 3);
   buffer_size_lb = gtk_label_new("Buffer size:");
   gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
@@ -2179,7 +2179,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
   g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_CB_KEY, snap_cb);
   g_object_set_data(G_OBJECT(cap_open_w), E_CAP_SNAP_SB_KEY, snap_sb);
   g_object_set_data(G_OBJECT(cap_open_w), E_CAP_LT_OM_KEY, linktype_om);
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   g_object_set_data(G_OBJECT(cap_open_w), E_CAP_BUFFER_SIZE_SB_KEY, buffer_size_sb);
 #endif
   g_object_set_data(G_OBJECT(cap_open_w), E_CAP_PROMISC_KEY, promisc_cb);
@@ -2547,7 +2547,7 @@ capture_dlg_prep(gpointer parent_w) {
 #ifdef HAVE_PCAP_REMOTE
   GtkWidget *iftype_cbx;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   GtkWidget *buffer_size_sb;
 #endif
   gchar *entry_text;
@@ -2566,7 +2566,7 @@ capture_dlg_prep(gpointer parent_w) {
   snap_cb    = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_CB_KEY);
   snap_sb    = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_SNAP_SB_KEY);
   linktype_om  = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_LT_OM_KEY);
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_BUFFER_SIZE_SB_KEY);
 #endif
   promisc_cb = (GtkWidget *) g_object_get_data(G_OBJECT(parent_w), E_CAP_PROMISC_KEY);
@@ -2627,7 +2627,7 @@ capture_dlg_prep(gpointer parent_w) {
     global_capture_opts.src_type = CAPTURE_IFREMOTE;
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   global_capture_opts.buffer_size =
     gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb));
 #endif
index c72163750f11a39d207312c1c690fbb601465556..89123ea937bb51c9346262122b02777853d24d29 100644 (file)
@@ -1161,7 +1161,7 @@ print_usage(gboolean print_ver) {
   fprintf(output, "  -Q                       quit Wireshark after capturing\n");
   fprintf(output, "  -S                       update packet display when new packets are captured\n");
   fprintf(output, "  -l                       turn on automatic scrolling while -S is in use\n");
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   fprintf(output, "  -B <buffer size>         size of kernel buffer (def: 1MB)\n");
 #endif
   fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -2021,7 +2021,7 @@ main(int argc, char *argv[])
 
 #define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
 
-#if defined HAVE_LIBPCAP && defined HAVE_PCAP_SET_BUFFER_SIZE
+#if defined HAVE_LIBPCAP && defined HAVE_PCAP_CREATE
 #define OPTSTRING_EXTRA "B:"
 #else
 #define OPTSTRING_EXTRA ""
@@ -2393,9 +2393,9 @@ main(int argc, char *argv[])
       case 'S':        /* "Sync" mode: used for following file ala tail -f */
       case 'w':        /* Write to capture file xxx */
       case 'y':        /* Set the pcap data link type */
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
       case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
+#endif /* _WIN32 or HAVE_PCAP_CREATE */
 #ifdef HAVE_LIBPCAP
         status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
                                       &start_capture);
index 6015f9c55ffdbf300fcb986897ca492d1f881da7..bc5cc543250b7f7fbcdd64a616fdf47e25441785 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -232,7 +232,7 @@ print_usage(gboolean print_ver)
   fprintf(output, "  -f <capture filter>      packet filter in libpcap filter syntax\n");
   fprintf(output, "  -s <snaplen>             packet snapshot length (def: 65535)\n");
   fprintf(output, "  -p                       don't capture in promiscuous mode\n");
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   fprintf(output, "  -B <buffer size>         size of kernel buffer (def: 1MB)\n");
 #endif
   fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -769,11 +769,11 @@ main(int argc, char *argv[])
 
 #define OPTSTRING_INIT "a:b:c:C:d:De:E:f:F:G:hi:K:lLnN:o:pPqr:R:s:St:T:u:vVw:xX:y:z:"
 #ifdef HAVE_LIBPCAP
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
 #define OPTSTRING_EXTRA "B:"
 #else
 #define OPTSTRING_EXTRA ""
-#endif  /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
+#endif  /* _WIN32 or HAVE_PCAP_CREATE */
 #else
 #define OPTSTRING_EXTRA ""
 #endif  /* HAVE_LIBPCAP */
@@ -1003,9 +1003,9 @@ main(int argc, char *argv[])
       case 's':        /* Set the snapshot (capture) length */
       case 'w':        /* Write to capture file x */
       case 'y':        /* Set the pcap data link type */
-#if defined(_WIN32) || defined(HAVE_PCAP_SET_BUFFER_SIZE)
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
       case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_SET_BUFFER_SIZE */
+#endif /* _WIN32 or HAVE_PCAP_CREATE */
 #ifdef HAVE_LIBPCAP
         status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
         if(status != 0) {