Set "v120len" regardless of whether "tree" is null or not; we use it
[obnox/wireshark/wip.git] / README.aix
1 After much work and toil, Craig Rodrigues was able to compile libpcap and Ethereal
2 on AIX 4.3.2. His odyssey is document in various e-mails at
3 http://ethereal.zing.org/lists/ethereal-dev/199911/
4
5 Here are a few excerpts.
6
7
8
9 Subject: Re: [ethereal-dev] Re: [ethereal-users] Problems compiling 0.7.7 under AIX 4.3.2 
10 From: Gilbert Ramirez <gram@xiexie.org> 
11 Date: Fri, 5 Nov 1999 16:58:17 -0600 
12 To: Guy Harris <guy@netapp.com> 
13 Cc: Craig Rodrigues <rodrigc@mediaone.net>, ethereal-dev@zing.org 
14
15
16 On Fri, Nov 05, 1999 at 01:42:44PM -0600, Guy Harris wrote:
17
18
19 > Hmm.
20
21 > Looks suspiciously similar to the previous error; have you tried
22 > recompiling GTK+ with "xlc_r"?
23
24 I believe glib and gtk+ should both be compiled with xlc_r. I haven't
25 compiled on AIX in a long time, but I think it's because glib is including
26 pthread stuff, so the re-entrant C library, libc_r, is needed. 
27
28
29 Compiler Invocation
30
31 When compiling a multi-threaded program, you should invoke the C compiler
32 using one of the following commands:
33
34 xlc_r
35     Invokes the compiler with default language level of ansi.
36 cc_r
37     Invokes the compiler with default language level of extended.
38
39
40 These commands ensure that the adequate options and libraries are used to be
41 compliant with the X/Open Version 5 Standard. The POSIX Threads
42 Specification 1003.1c is a subset of the X/Open Specification.
43
44 The following libraries are automatically linked with your program when using these commands:
45
46 libpthreads.a
47             Threads library.
48 libc.a
49             Standard C library
50
51
52 For example, the following command compiles the foo.c multi-threaded C source file and produces the foo executable file:
53
54 cc_r -o foo foo.c
55
56 See the cc command for more information about C For AIX.
57
58
59 --gilbert
60
61
62 To: ethereal-users@zing.org 
63 Subject: [ethereal-dev] AIX: gtk problem solved, now an ethereal problem 
64 From: Craig Rodrigues <rodrigc@mediaone.net> 
65 Date: Mon, 8 Nov 1999 10:46:25 -0500 
66 Cc: ethereal-dev@zing.org 
67
68
69 Hi,
70
71 After much sweat and toil, I have managed to get gtk 1.2.6 to
72 compile and not dump core under AIX.  The solutions were to
73 (1) apply the attached patch to the configure.in in the glib-1.2.6
74 subdirectory
75
76 (2)  In the file gtk+-1.2.6/gtk/Makefile, add a link flag -lgdk to link
77 in gdk.
78
79 I have submitted (1) to the gtk-devel mailing list where it has been
80 accepted.  (2) is an uglier problem, but for now, adding -lgdk by hand
81 seems to work.
82
83 Now I have a problem....I compiled gtk, and that works.
84 I compiled ethereal (after some minor mods), and it starts,
85 but when I click on Capture -> Start, I get:
86
87 "There are no network interfaces that can be opened."
88
89 I am running as root, so I don't think permissions are a problem.
90
91 Any ideas?
92
93 Thanks.
94 -- 
95 Craig Rodrigues        
96 http://www.gis.net/~craigr    
97 rodrigc@mediaone.net          
98
99 *** configure.in.old    Thu Oct  7 17:27:43 1999
100 --- configure.in        Sun Nov  7 19:34:36 1999
101 ***************
102 *** 795,809 ****
103           fi
104           if test "$ac_cv_func_getpwuid_r" = "yes"; then
105                   AC_MSG_CHECKING(whether getpwuid_r is posix like)
106 !                       # getpwuid_r(0, NULL, NULL, 0) is the signature on
107 !                       # solaris, if that is not found, the prog below won't 
108 !                       # compile, then the posix signature is assumed as 
109 !                       # the default.
110 !                       AC_TRY_COMPILE([#include <pwd.h>],
111 !                               [getpwuid_r(0, NULL, NULL, 0);],
112 !                               [AC_MSG_RESULT(no)],
113 !                               [AC_MSG_RESULT(yes)
114 !                               AC_DEFINE(HAVE_GETPWUID_R_POSIX)])
115           fi
116   fi
117   if test x"$have_threads" = xposix; then
118 --- 795,809 ----
119           fi
120           if test "$ac_cv_func_getpwuid_r" = "yes"; then
121                   AC_MSG_CHECKING(whether getpwuid_r is posix like)
122 !                       # The signature for the POSIX version is:
123 !                       # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **)
124 !                       AC_TRY_COMPILE([#include <pwd.h>
125 !                                         #include <sys/types.h>
126 !                                         #include <stdlib.h>],
127 !                               [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
128 !                               [AC_DEFINE(HAVE_GETPWUID_R_POSIX)
129 !                               AC_MSG_RESULT(yes)],
130 !                               [AC_MSG_RESULT(no)])
131           fi
132   fi
133   if test x"$have_threads" = xposix; then
134
135
136
137 To: ethereal-dev@zing.org 
138 Subject: Re: [ethereal-dev] AIX: gtk problem solved, now an ethereal problem 
139 From: Craig Rodrigues <rodrigc@mediaone.net> 
140 Date: Wed, 10 Nov 1999 12:18:47 -0500 
141
142
143
144 Hi,
145
146 OK, I'm getting closer and closer to this working on AIX.
147
148 Things I've done:
149
150 (1) In a bunch of places in the code I removed '//' style C++ comments
151 which the IBM C compiler didn't like.
152
153 (2) I also found some places in the code like:
154
155 enum some_enum {  FOO, BAR, };
156
157 IBM C did not like the trailing "," after BAR.
158
159 (3) In packet-ipv6.h, IPV6_VERSION is defined, but that is already
160 defined in <netinet/in.h> on AIX 4.3, so for now I just commented that out.
161
162 (4) in packet-afs.c, when it sucks in <netinet/in.h>,  in.h sucks in
163 <sys/machine.h> which defines LITTLE_ENDIAN.  This conflicts with
164 LITTLE_ENDIAN in globals.h.  So what I did was, in globals.h, I added:
165
166 #ifdef HAVE_NETINET_IN_H
167 #include <netinet/in.h>
168 #endif
169
170 So after doing all these things, I can compile ethereal and run it.  
171 I can list the
172 correct network interfaces on my system: lo0 and en0.  However,
173 when I start capturing packets on en0, they are all of the protocol type
174 "TRMAC" and "TR".  The only problem is, I'm not on a Token Ring network.
175
176 Any ideas?
177
178 No. Time        Source                Destination           Protocol   Info
179 1 0.000000    0a:30:a1:08:00:45     06:74:60:08:00:5a     TR   Token-Ring Unknown
180 2 0.210304    0a:30:a1:08:00:45     06:74:60:08:00:5a     TR   Token-Ring Unknown
181 3 0.926080    0a:30:a1:08:00:45     06:74:60:08:00:5a     TR   Token-Ring Unknown
182 4 0.4236416   0a:30:a1:08:00:45     06:74:60:08:00:5a     TR   Token-Ring Unknown
183 5 0.4712064   6f:06:74:60:08:00     5a:8a:30:a1:00:00 TR MAC Unknown Major Vector: 127
184
185
186 ---------------------
187 It turns out that libpcap was using IFT_* numbers instead of DLT_* numbers for
188 link types. That has been fixed
189 ---------------------
190
191
192 To: tcpdump-workers@tcpdump.org 
193 Subject: [ethereal-dev] Sucess with libpcap under AIX 
194 From: Craig Rodrigues <rodrigc@mediaone.net> 
195 Date: Sat, 20 Nov 1999 03:34:50 -0500 
196 Cc: ethereal-dev@zing.org 
197
198
199 Hi,
200
201 I have managed to successfully compile and use the latest
202 snapshot of libpcap under AIX using DLPI.  bpf is majorly
203 brain-dead under AIX, and very unsupported.  Rather than
204 find all the bugs in AIX's bpf, I decided to try using
205 dlpi, which is officially supported.
206
207 The first step is to get the setup right.  To determine if
208 you have the dlpi driver loaded correctly, type:
209 strload -q -d dlpi
210
211 If the result is:
212 dlpi: yes
213
214 then you are ready to use dlpi.
215
216 If you get:
217 dlpi: no
218
219 Then you need to type:
220 strload -f /etc/dlpi.conf
221
222 Check again with strload -q -d dlpi that the dlpi driver is loaded.
223
224 I had to make one minor code change to pcap-dlpi.c.  Maybe someone
225 can explain it to me, because I am not familiar with dlpi or
226 streams programming.  It took me hours to figure this out, because
227 I'm not familiar with dlpi.
228
229 In pcap-dlpi.c, lines 316-320:
230 #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix)
231        if (dlbindreq(p->fd, 0, ebuf) < 0 ||
232            dlbindack(p->fd, (char *)buf, ebuf) < 0)
233             goto bad;
234 #endif
235
236 I changed it to:
237 #if !defined(HAVE_HPUX9) && !defined(HAVE_HPUX10_20) && !defined(sinix)
238        if (dlbindreq(p->fd, 1620, ebuf) < 0 ||
239            dlbindack(p->fd, (char *)buf, ebuf) < 0)
240             goto bad;
241 #endif
242
243 I picked the number 1620 out of thin air.  The second parameter
244 to dlbindreq() sets the value of dl_sap.  This dl_sap
245 value is then passed along to the DLPI driver through
246 the DL_BIND_REQ primitive.  I guess that it cannot be 0 under
247 AIX, but I'm not sure.
248
249 If someone knows anything about DLPI, I'd appreciate a clarification.
250 Basically, I am just using the DLPI specification at:
251 http://www.opengroup.org/onlinepubs/009638599/ which is pretty good.
252 The AIX documentation is not so well written.
253
254 But basically, after I fixed up pcap-dlpi.c, I managed to get libpcap
255 working under AIX.  This enabled me to successfully run Ethereal,
256 ie. all the packets on my Ethernet network correctly showed up
257 as Ethernet and not Token Ring in the Ethereal screen.
258
259 YAY!
260 -- 
261 Craig Rodrigues        
262 http://www.gis.net/~craigr    
263 rodrigc@mediaone.net          
264
265