Ethereal-dev: [Ethereal-dev] Patch to make ethereal-0.10.2 work on Cygwin with packet capture
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Stephen Blackheath <stephen@xxxxxxxxxxxxxxxxx>
Date: Mon, 8 Mar 2004 16:01:34 +1300
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All, The attached patch to ethereal-0.10.2 makes it work on Cygwin with packet capture, using WinPCap 3.0 for the packet capture. There were a couple of minor problems with the build, and also an issue with 'ethclist.c'. Steve -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAS+IOODO5z8eA7sQRAuFKAJ42yiAOYylmgNQnm1yMKybX8Yen3wCfV7kW s2jv7VmKuI6oxO1c7TiSMeo= =y9tU -----END PGP SIGNATURE-----
--- ethereal-0.10.2.orig/Makefile.am 2004-02-23 04:01:18.000000000 +1300
+++ ethereal-0.10.2/Makefile.am 2004-03-08 14:12:41.011588800 +1300
@@ -83,7 +83,7 @@
diameter_DATA = dictionary.dtd dictionary.xml mobileipv4.xml \
nasreq.xml sunping.xml
-PLATFORM_SRC = pcap-util-unix.c
+PLATFORM_SRC = capture-wpcap.c
include Makefile.common
--- ethereal-0.10.2.orig/tethereal.c 2004-02-24 13:20:32.000000000 +1300
+++ ethereal-0.10.2/tethereal.c 2004-03-08 13:36:17.882403200 +1300
@@ -103,7 +103,7 @@
#include <wiretap/libpcap.h>
#endif
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
#include "capture-wpcap.h"
#endif
@@ -929,7 +929,7 @@
g_free(dp_path);
}
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
/* Load Wpcap, if possible */
load_wpcap();
#endif
--- ethereal-0.10.2.orig/gtk/main.c 2004-02-24 13:20:33.000000000 +1300
+++ ethereal-0.10.2/gtk/main.c 2004-03-08 15:55:03.754419200 +1300
@@ -127,7 +127,7 @@
#include "recent.h"
#include "follow_dlg.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN)
#include "capture-wpcap.h"
#endif
@@ -2062,10 +2062,12 @@
init_cap_file(&cfile);
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
/* Load wpcap if possible. Do this before collecting the run-time version information */
load_wpcap();
+#endif
+#if defined(WIN32)
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
#endif /* WIN32 */
--- ethereal-0.10.2.orig/capture-wpcap.c 2004-01-07 15:46:33.000000000 +1300
+++ ethereal-0.10.2/capture-wpcap.c 2004-03-08 13:36:17.912446400 +1300
@@ -41,6 +41,8 @@
/* XXX - yes, I know, I should move cppmagic.h to a generic location. */
#include "tools/lemon/cppmagic.h"
+#define WPCAP_CONSTIFIED
+
gboolean has_wpcap = FALSE;
#ifdef HAVE_LIBPCAP
@@ -82,7 +84,6 @@
void
load_wpcap(void)
{
-
/* These are the symbols I need or want from Wpcap */
static const symbol_table_t symbols[] = {
SYM(pcap_lookupdev, FALSE),
--- ethereal-0.10.2.orig/acinclude.m4 2003-12-22 05:49:23.000000000 +1300
+++ ethereal-0.10.2/acinclude.m4 2004-03-08 13:36:17.922460800 +1300
@@ -320,42 +320,56 @@
#
# Check to see if we find "pcap_open_live" in "-lpcap".
#
- AC_CHECK_LIB(pcap, pcap_open_live,
- [
- PCAP_LIBS=-lpcap
- AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
- ], [AC_MSG_ERROR(Library libpcap not found.)],
- $SOCKET_LIBS $NSL_LIBS)
+ case "$host_os" in
+ cygwin*)
+ AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
+ PCAP_LIBS=
+ ;;
+ *)
+ AC_CHECK_LIB(pcap, pcap_open_live,
+ [
+ PCAP_LIBS=-lpcap
+ AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
+ ], [AC_MSG_ERROR(Library libpcap not found.)],
+ $SOCKET_LIBS $NSL_LIBS)
+ ;;
+ esac
AC_SUBST(PCAP_LIBS)
#
# Check whether various variables and functions are defined by
# libpcap.
#
- ac_save_LIBS="$LIBS"
- AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
- LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
- AC_TRY_LINK(
- [
-# include <stdio.h>
- extern char *pcap_version;
- ],
- [
- printf ("%s\n", pcap_version);
- ],
- ac_cv_pcap_version_defined=yes,
- ac_cv_pcap_version_defined=no,
- [echo $ac_n "cross compiling; assumed OK... $ac_c"])
- if test "$ac_cv_pcap_version_defined" = yes ; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
- else
- AC_MSG_RESULT(no)
- fi
- AC_CHECK_FUNCS(pcap_findalldevs pcap_lib_version pcap_open_dead)
- AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
- AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink)
- LIBS="$ac_save_LIBS"
+ case "$host_os" in
+ cygwin*)
+ ;;
+ *)
+ ac_save_LIBS="$LIBS"
+ AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
+ LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
+ AC_TRY_LINK(
+ [
+# include <stdio.h>
+ extern char *pcap_version;
+ ],
+ [
+ printf ("%s\n", pcap_version);
+ ],
+ ac_cv_pcap_version_defined=yes,
+ ac_cv_pcap_version_defined=no,
+ [echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ if test "$ac_cv_pcap_version_defined" = yes ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
+ else
+ AC_MSG_RESULT(no)
+ fi
+ AC_CHECK_FUNCS(pcap_findalldevs pcap_lib_version pcap_open_dead)
+ AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
+ AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink)
+ LIBS="$ac_save_LIBS"
+ ;;
+ esac
])
#
--- ethereal-0.10.2.orig/configure.in 2004-02-24 13:20:31.000000000 +1300
+++ ethereal-0.10.2/configure.in 2004-03-08 15:54:08.334729600 +1300
@@ -94,6 +94,7 @@
#
# Add any platform-specific compiler flags needed.
#
+
AC_MSG_CHECKING(for platform-specific compiler flags)
if test "x$GCC" = x
then
--- ethereal-0.10.2.orig/gtk/Makefile.am 2004-02-24 13:20:32.000000000 +1300
+++ ethereal-0.10.2/gtk/Makefile.am 2004-03-08 14:35:27.806944000 +1300
@@ -88,8 +88,6 @@
$(ETHEREAL_TAP_SRC)
else
libui_a_SOURCES = \
- ethclist.c \
- ethclist.h \
$(ETHEREAL_GTK_SRC) \
$(noinst_HEADERS) \
$(ETHEREAL_TAP_SRC)
--- ethereal-0.10.2.orig/README.win32 2004-02-24 13:20:31.000000000 +1300
+++ ethereal-0.10.2/README.win32 2004-03-08 13:36:17.952504000 +1300
@@ -408,12 +408,9 @@
$ make check
$ make install
-5. Patch Makefile.am in <ethereal-src>/gtk/Makefile.am by
- removing "ethclist.c" from the dependencies.
-
- This patch is required since the private GTK+ clist widget
- (was required for earlier versions of GTK+ but prevents Ethereal
- from running with cygwin).
+5. For packet capture to work, you will need to install the developer
+ pack for WinPCap, which is called "wpdpack". Version 3.0 is known
+ to work.
6. Configure and make Ethereal:
@@ -421,8 +418,8 @@
$ PATH=/opt/gnome/bin:$PATH
- $ ./autogen.sh --without-pcap --without-plugins
- $ ./configure --without-pcap --without-plugins
+ $ ./autogen.sh
+ $ ./configure --with-pcap=<wpdpack_dir> --without-plugins
$ make
This make will eventually stop, but it is required as e.g., the
@@ -444,11 +441,6 @@
And voila! Behold the mighty sniffer in all its glory!
-Something is wrong with the makefile that gets generated, so it doesn't work
-just running make.
-I am not curious enough to look at why 'make' doesnt work; 'make ethereal.exe'
-works well enough for me.
-
Note: Compiling Ethereal under cygwin takes a lot of time, because the
generation of 'register.c' takes ages. If you only edit one dissector and
you know what you're doing, it is acceptable to uncomment the generation
--- ethereal-0.10.2.orig/gtk/packet_list.c 2004-02-09 15:18:35.000000000 +1300
+++ ethereal-0.10.2/gtk/packet_list.c 2004-03-08 14:37:52.184548800 +1300
@@ -54,8 +54,9 @@
* This lets us use GtkCList in GTK+ 1.3[.x] and later, and EthCList on
* GTK+ 1.2[.x], at least until we either use GTK+ 2.x's native widgets
* or make EthCList work on 1.3[.x] and 2.x.
+ * On CygWin, EthCList doesn't work properly, so we use GtkCList with GTK+ 1.2.
*/
-#if GTK_MAJOR_VERSION >= 2 || GTK_MINOR_VERSION >= 3
+#if GTK_MAJOR_VERSION >= 2 || GTK_MINOR_VERSION >= 3 || (defined(__CYGWIN__) && GTK_MINOR_VERSION >= 2)
#define EthCList GtkCList
#define EthCListRow GtkCListRow
#define eth_clist_append gtk_clist_append
--- ethereal-0.10.2.orig/gtk/Makefile.am 2004-02-24 13:20:32.000000000 +1300
+++ ethereal-0.10.2/gtk/Makefile.am 2004-03-08 14:35:27.806944000 +1300
@@ -88,8 +88,6 @@
$(ETHEREAL_TAP_SRC)
else
libui_a_SOURCES = \
- ethclist.c \
- ethclist.h \
$(ETHEREAL_GTK_SRC) \
$(noinst_HEADERS) \
$(ETHEREAL_TAP_SRC)
- Prev by Date: [Ethereal-dev] Shared libs for Unix - Take 4
- Next by Date: [Ethereal-dev] Build problems under RH 9.0 fixed ...
- Previous by thread: [Ethereal-dev] Shared libs for Unix - Take 4
- Next by thread: [Ethereal-dev] Build problems under RH 9.0 fixed ...
- Index(es):





