New tap for tethereal: io statistics that provides frames/bytes counts for frames...
[obnox/wireshark/wip.git] / README.irix
1 $Id: README.irix,v 1.4 2001/01/10 09:54:44 guy Exp $
2
3 1. Some problems seen by one person who tried to build Ethereal on IRIX;
4 your mileage may vary.
5
6 To: ethereal-dev@zing.org
7 Subject: Re: [ethereal-dev] Ethereal on SGI
8 From: Randall Hopper <aa8vb@yahoo.com>
9 Date: Sat, 18 Sep 1999 12:19:31 -0400
10
11  |>      Just tried to build ethereal on SGI IRIX.  configure failed because
12  |> there is no net/bpf.h.
13
14 Thanks for all the help.  I pulled the latest today (0.7.3), and after a
15 few fix-ups, I got it built.  Here are the tweaks I needed to build it for
16 SGI IRIX 6.5 using gcc.
17
18 ==========
19 PROBLEM #1
20 ==========
21
22    Ethereal doesn't use RPATH (see ld(1) for shared library linking on all
23    platforms that support it (e.g. SGI IRIX, FreeBSD ELF, etc.), just
24    Solaris it appears.  Instead, ethereal recommends use of the
25    LD_LIBRARY_PATH hack which causes all sorts problems.
26
27    On SGI IRIX this is -rpath to the linker, on Solaris -R, on FreeBSD ELF
28    --rpath, etc.
29
30    SOLUTION: Slip in my linker flags when configuring ethereal so it can
31              find libgtk, libgmodule, libsnmp, etc. at run-time without
32              LD_LIBRARY_PATH:
33
34    env LDFLAGS="-rpath $HOME/software/gtk+-1.2.3/lib:$HOME/software/glib-1.2.3/lib:/usr/local/lib" configure --prefix=$HOME/software/ethereal-0.7.3 --with-gtk-prefix=$HOME/software/gtk+-1.2.3
35
36    BETTER SOLUTION:  Modify configure to support RPATH for more platforms
37                      than Solaris.
38
39 ==========
40 PROBLEM #2
41 ==========
42
43    __P not defined -- packet-snmp.c fails to build
44    (gcc version 2.95.1 19990816 (release), SGI IRIX 6.5.5f)
45
46    SOLUTION:  Include gnuc.h -- it defines it
47
48    --- ORIG/packet-snmp.c  Mon Aug 30 11:10:17 1999
49    +++ packet-snmp.c       Sat Sep 18 11:35:45 1999
50    @@ -25,4 +25,6 @@
51      */
52
53    +#include "gnuc.h"
54    +
55     #ifdef HAVE_CONFIG_H
56     # include "config.h"
57
58 Randall
59
60 ===============================================================================
61
62 Problem #1:
63
64 checking for GTK - version >= 1.2.0... 186062:./conftest: rld: Fatal Error: Cannot Successfully map soname 'libgtk-1.2.so.1' under any of the filenames /usr/lib32/libgtk-1.2.so.1:/usr/lib32/internal/libgtk-1.2.so.1:/lib32/libgtk-1.2.so.1:/opt/lib32/libgtk
65 no
66 *** Could not run GTK test program, checking why...
67 *** The test program compiled, but did not run. This usually means
68 *** that the run-time linker is not finding GTK or finding the wrong
69 *** version of GTK. If it is not finding GTK, you'll need to set your
70 *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
71 *** to the installed location  Also, make sure you have run ldconfig if that
72 *** is required on your system
73 ***
74 *** If you have an old version installed, it is best to remove it, although
75 *** you may also be able to get things to work by modifying LD_LIBRARY_PATH
76 ***
77 *** If you have a RedHat 5.0 system, you should remove the GTK package that
78 *** came with the system with the command
79 ***
80 ***    rpm --erase --nodeps gtk gtk-devel
81 configure: error: GTK+ distribution not found.
82
83 ==============================================================================
84
85 Problem #2:
86
87 gcc -DHAVE_CONFIG_H -I. -I. -I.     -Wall -g -O2 -Iwiretap -I/home/rhh/software/gtk+-1.2.3/include -I/home/rhh/software/glib-1.2.3/lib/glib/include -I/home/rhh/software/glib-1.2.3/include -c packet-snmp.c
88 In file included from packet-snmp.c:62:
89 /usr/local/include/ucd-snmp/asn1.h:131: parse error before `__P'
90 /usr/local/include/ucd-snmp/asn1.h:132: parse error before `__P'
91 /usr/local/include/ucd-snmp/asn1.h:133: parse error before `__P'
92 /usr/local/include/ucd-snmp/asn1.h:134: parse error before `__P'
93 /usr/local/include/ucd-snmp/asn1.h:135: parse error before `__P'
94 ...
95 packet-snmp.c: In function `dissect_snmp':
96 packet-snmp.c:344: warning: implicit declaration of function `asn_parse_header'
97 packet-snmp.c:358: warning: implicit declaration of function `snmp_comstr_parse'
98 packet-snmp.c:358: warning: assignment makes pointer from integer without a cast
99 packet-snmp.c:407: warning: assignment makes pointer from integer without a cast
100 ...
101 packet-snmp.c: In function `proto_register_snmp':
102 packet-snmp.c:869: warning: implicit declaration of function `init_mib'
103 gmake[2]: *** [packet-snmp.o] Error 1
104 gmake[2]: Leaving directory `/home/rhh/software/PKGS/t/ethereal-0.7.3'
105 gmake[1]: *** [all-recursive] Error 1
106 gmake[1]: Leaving directory `/home/rhh/software/PKGS/t/ethereal-0.7.3'
107 gmake: *** [all-recursive-am] Error 2
108
109 -------------------------------------------------------------------------------
110
111 Problem #3 (same as Problem #1):
112
113 > ./ethereal 
114 189684:./ethereal: rld: Fatal Error: Cannot Successfully map soname 'libsnmp.so' under any of the filenames /home/rhh/software/gtk+-1.2.3/lib/libsnmp.so:/home/rhh/software/glib-1.2.3/lib/libsnmp.so:/usr/lib32/libsnmp.so:/usr/lib32/internal/libsnmp.so:/lib32/libsnmp.so:/opt/lib32/libsnmp.so: 
115
116 2. Patches to libpcap that may be necessary
117
118 On IRIX, the libpcap library uses, in "pcap_open_live()", the snapshot
119 length passed in, without reducing it to be less than or equal to the
120 MTU of the interface.  If the snapshot length is larger than the
121 interface MTU, IRIX will return an error; this means that, for example,
122 the Ethereal default snapshot length of 65535, chosen so that all of the
123 packet is captured, will not work.
124
125 Here is a patch to libpcap 0.4 source that should fix that problem.  If
126 it doesn't fix the problem, or if it reduces the snapshot length below
127 the MTU (so that a snapshot length of 65535 doesn't capture all the data
128 in the packets), please report this to ethereal-dev@ethereal.com, so
129 that we know that it didn't work - we'll probably send you debugging
130 patches in the hopes of being able to make it work.
131
132 diff -c ../libpcap-0.4/pcap-snoop.c ./pcap-snoop.c
133 *** ../libpcap-0.4/pcap-snoop.c Tue Apr  8 21:07:01 1997
134 --- ./pcap-snoop.c      Tue Jan 18 00:16:18 2000
135 ***************
136 *** 126,132 ****
137 --- 126,135 ----
138         struct sockaddr_raw sr;
139         struct snoopfilter sf;
140         u_int v;
141 +       int ll_hdrlen;
142 +       int snooplen;
143         pcap_t *p;
144 +       struct ifreq ifr;
145   
146         p = (pcap_t *)malloc(sizeof(*p));
147         if (p == NULL) {
148 ***************
149 *** 154,169 ****
150         }
151         v = 64 * 1024;
152         (void)setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&v, sizeof(v));
153 -       if (ioctl(fd, SIOCSNOOPLEN, &snaplen) < 0) {
154 -               sprintf(ebuf, "SIOCSNOOPLEN: %s", pcap_strerror(errno));
155 -               goto bad;
156 -       }
157 -       p->snapshot = snaplen;
158 -       v = 1;
159 -       if (ioctl(fd, SIOCSNOOPING, &v) < 0) {
160 -               sprintf(ebuf, "SIOCSNOOPING: %s", pcap_strerror(errno));
161 -               goto bad;
162 -       }
163         /*
164          * XXX hack - map device name to link layer type
165          */
166 --- 157,162 ----
167 ***************
168 *** 179,195 ****
169 --- 172,242 ----
170             strncmp("qaa", device, 3) == 0) {
171                 p->linktype = DLT_EN10MB;
172                 p->offset = RAW_HDRPAD(sizeof(struct ether_header));
173 +               ll_hdrlen = sizeof(struct ether_header);
174         } else if (strncmp("ipg", device, 3) == 0 ||
175                    strncmp("rns", device, 3) == 0 ||    /* O2/200/2000 FDDI */
176                    strncmp("xpi", device, 3) == 0) {
177                 p->linktype = DLT_FDDI;
178                 p->offset = 3;                          /* XXX yeah? */
179 +               ll_hdrlen = 13;
180         } else if (strncmp("ppp", device, 3) == 0) {
181                 p->linktype = DLT_RAW;
182 +               ll_hdrlen = 0;  /* DLT_RAW meaning "no PPP header, just the IP packet"? */
183         } else if (strncmp("lo", device, 2) == 0) {
184                 p->linktype = DLT_NULL;
185 +               ll_hdrlen = 4;  /* is this just like BSD's loopback device? */
186         } else {
187                 sprintf(ebuf, "snoop: unknown physical layer type");
188 +               goto bad;
189 +       }
190 + #ifdef SIOCGIFMTU
191 +       /*
192 +        * XXX - IRIX appears to give you an error if you try to set the
193 +        * capture length to be greater than the MTU, so let's try to get
194 +        * the MTU first and, if that succeeds, trim the snap length
195 +        * to be no greater than the MTU.
196 +        */
197 +       (void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
198 +       if (ioctl(fd, SIOCGIFMTU, (char *)&ifr) < 0) {
199 +               sprintf(ebuf, "SIOCGIFMTU: %s", pcap_strerror(errno));
200 +               goto bad;
201 +       }
202 +       /*
203 +        * OK, we got it.
204 +        * XXX - some versions of IRIX 6.5 define "ifr_mtu" and have an
205 +        * "ifru_metric" member of the "ifr_ifru" union in an "ifreq"
206 +        * structure, others don't.
207 +        *
208 +        * I've no idea what's going on, so, if "ifr_mtu" isn't defined,
209 +        * we define it as "ifr_metric", as using that field appears to
210 +        * work on the versions that lack "ifr_mtu" (and, on those that
211 +        * don't lack it, "ifru_metric" and "ifru_mtu" are both "int"
212 +        * members of the "ifr_ifru" union, which suggests that they
213 +        * may be interchangeable in this case).
214 +        */
215 + #ifndef ifr_mtu
216 + #define ifr_mtu       ifr_metric
217 + #endif
218 +       if (snaplen > ifr.ifr_mtu)
219 +               snaplen = ifr.ifr_mtu;
220 + #endif
221
222 +       /*
223 +        * The argument to SIOCSNOOPLEN is the number of link-layer
224 +        * payload bytes to capture - it doesn't count link-layer
225 +        * header bytes.
226 +        */
227 +       snooplen = snaplen - ll_hdrlen;
228 +       if (snooplen < 0)
229 +               snooplen = 0;
230 +       if (ioctl(fd, SIOCSNOOPLEN, &snooplen) < 0) {
231 +               sprintf(ebuf, "SIOCSNOOPLEN: %s", pcap_strerror(errno));
232 +               goto bad;
233 +       }
234 +       p->snapshot = snaplen;
235 +       v = 1;
236 +       if (ioctl(fd, SIOCSNOOPING, &v) < 0) {
237 +               sprintf(ebuf, "SIOCSNOOPING: %s", pcap_strerror(errno));
238                 goto bad;
239         }
240   
241