After much work and toil, Craig Rodrigues was able to compile libpcap and Ethereal on AIX 4.3.2. His odyssey is document in various e-mails at http://ethereal.zing.org/lists/ethereal-dev/199911/ Here are a few excerpts. Subject: Re: [ethereal-dev] Re: [ethereal-users] Problems compiling 0.7.7 under AIX 4.3.2 From: Gilbert Ramirez Date: Fri, 5 Nov 1999 16:58:17 -0600 To: Guy Harris Cc: Craig Rodrigues , ethereal-dev@zing.org On Fri, Nov 05, 1999 at 01:42:44PM -0600, Guy Harris wrote: > > > Hmm. > > Looks suspiciously similar to the previous error; have you tried > recompiling GTK+ with "xlc_r"? I believe glib and gtk+ should both be compiled with xlc_r. I haven't compiled on AIX in a long time, but I think it's because glib is including pthread stuff, so the re-entrant C library, libc_r, is needed. Compiler Invocation When compiling a multi-threaded program, you should invoke the C compiler using one of the following commands: xlc_r Invokes the compiler with default language level of ansi. cc_r Invokes the compiler with default language level of extended. These commands ensure that the adequate options and libraries are used to be compliant with the X/Open Version 5 Standard. The POSIX Threads Specification 1003.1c is a subset of the X/Open Specification. The following libraries are automatically linked with your program when using these commands: libpthreads.a Threads library. libc.a Standard C library For example, the following command compiles the foo.c multi-threaded C source file and produces the foo executable file: cc_r -o foo foo.c See the cc command for more information about C For AIX. --gilbert To: ethereal-users@zing.org Subject: [ethereal-dev] AIX: gtk problem solved, now an ethereal problem From: Craig Rodrigues Date: Mon, 8 Nov 1999 10:46:25 -0500 Cc: ethereal-dev@zing.org Hi, After much sweat and toil, I have managed to get gtk 1.2.6 to compile and not dump core under AIX. The solutions were to (1) apply the attached patch to the configure.in in the glib-1.2.6 subdirectory (2) In the file gtk+-1.2.6/gtk/Makefile, add a link flag -lgdk to link in gdk. I have submitted (1) to the gtk-devel mailing list where it has been accepted. (2) is an uglier problem, but for now, adding -lgdk by hand seems to work. Now I have a problem....I compiled gtk, and that works. I compiled ethereal (after some minor mods), and it starts, but when I click on Capture -> Start, I get: "There are no network interfaces that can be opened." I am running as root, so I don't think permissions are a problem. Any ideas? Thanks. -- Craig Rodrigues http://www.gis.net/~craigr rodrigc@mediaone.net *** configure.in.old Thu Oct 7 17:27:43 1999 --- configure.in Sun Nov 7 19:34:36 1999 *************** *** 795,809 **** fi if test "$ac_cv_func_getpwuid_r" = "yes"; then AC_MSG_CHECKING(whether getpwuid_r is posix like) ! # getpwuid_r(0, NULL, NULL, 0) is the signature on ! # solaris, if that is not found, the prog below won't ! # compile, then the posix signature is assumed as ! # the default. ! AC_TRY_COMPILE([#include ], ! [getpwuid_r(0, NULL, NULL, 0);], ! [AC_MSG_RESULT(no)], ! [AC_MSG_RESULT(yes) ! AC_DEFINE(HAVE_GETPWUID_R_POSIX)]) fi fi if test x"$have_threads" = xposix; then --- 795,809 ---- fi if test "$ac_cv_func_getpwuid_r" = "yes"; then AC_MSG_CHECKING(whether getpwuid_r is posix like) ! # The signature for the POSIX version is: ! # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **) ! AC_TRY_COMPILE([#include ! #include ! #include ], ! [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);], ! [AC_DEFINE(HAVE_GETPWUID_R_POSIX) ! AC_MSG_RESULT(yes)], ! [AC_MSG_RESULT(no)]) fi fi if test x"$have_threads" = xposix; then To: ethereal-dev@zing.org Subject: Re: [ethereal-dev] AIX: gtk problem solved, now an ethereal problem From: Craig Rodrigues Date: Wed, 10 Nov 1999 12:18:47 -0500 Hi, OK, I'm getting closer and closer to this working on AIX. Things I've done: (1) In a bunch of places in the code I removed '//' style C++ comments which the IBM C compiler didn't like. (2) I also found some places in the code like: enum some_enum { FOO, BAR, }; IBM C did not like the trailing "," after BAR. (3) In packet-ipv6.h, IPV6_VERSION is defined, but that is already defined in on AIX 4.3, so for now I just commented that out. (4) in packet-afs.c, when it sucks in , in.h sucks in which defines LITTLE_ENDIAN. This conflicts with LITTLE_ENDIAN in globals.h. So what I did was, in globals.h, I added: #ifdef HAVE_NETINET_IN_H #include #endif So after doing all these things, I can compile ethereal and run it. I can list the correct network interfaces on my system: lo0 and en0. However, when I start capturing packets on en0, they are all of the protocol type "TRMAC" and "TR". The only problem is, I'm not on a Token Ring network. Any ideas? No. Time Source Destination Protocol Info 1 0.000000 0a:30:a1:08:00:45 06:74:60:08:00:5a TR Token-Ring Unknown 2 0.210304 0a:30:a1:08:00:45 06:74:60:08:00:5a TR Token-Ring Unknown 3 0.926080 0a:30:a1:08:00:45 06:74:60:08:00:5a TR Token-Ring Unknown 4 0.4236416 0a:30:a1:08:00:45 06:74:60:08:00:5a TR Token-Ring Unknown 5 0.4712064 6f:06:74:60:08:00 5a:8a:30:a1:00:00 TR MAC Unknown Major Vector: 127 --------------------- It turns out that libpcap was using IFT_* numbers instead of DLT_* numbers for link types. That has been fixed --------------------- To: tcpdump-workers@tcpdump.org Subject: [ethereal-dev] Sucess with libpcap under AIX From: Craig Rodrigues Date: Sat, 20 Nov 1999 03:34:50 -0500 Cc: ethereal-dev@zing.org Hi, I have managed to successfully compile and use the latest snapshot of libpcap under AIX using DLPI. bpf is majorly brain-dead under AIX, and very unsupported. Rather than find all the bugs in AIX's bpf, I decided to try using dlpi, which is officially supported. The first step is to get the setup right. To determine if you have the dlpi driver loaded correctly, type: strload -q -d dlpi If the result is: dlpi: yes then you are ready to use dlpi. If you get: dlpi: no Then you need to type: strload -f /etc/dlpi.conf Check again with strload -q -d dlpi that the dlpi driver is loaded. I had to make one minor code change to pcap-dlpi.c. Maybe someone can explain it to me, because I am not familiar with dlpi or streams programming. It took me hours to figure this out, because I'm not familiar with dlpi. In pcap-dlpi.c, lines 316-320: #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix) if (dlbindreq(p->fd, 0, ebuf) < 0 || dlbindack(p->fd, (char *)buf, ebuf) < 0) goto bad; #endif I changed it to: #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix) if (dlbindreq(p->fd, 1620, ebuf) < 0 || dlbindack(p->fd, (char *)buf, ebuf) < 0) goto bad; #endif I picked the number 1620 out of thin air. The second parameter to dlbindreq() sets the value of dl_sap. This dl_sap value is then passed along to the DLPI driver through the DL_BIND_REQ primitive. I guess that it cannot be 0 under AIX, but I'm not sure. If someone knows anything about DLPI, I'd appreciate a clarification. Basically, I am just using the DLPI specification at: http://www.opengroup.org/onlinepubs/009638599/ which is pretty good. The AIX documentation is not so well written. But basically, after I fixed up pcap-dlpi.c, I managed to get libpcap working under AIX. This enabled me to successfully run Ethereal, ie. all the packets on my Ethernet network correctly showed up as Ethernet and not Token Ring in the Ethereal screen. YAY! -- Craig Rodrigues http://www.gis.net/~craigr rodrigc@mediaone.net