[Iftop-users] iftop 0.17 On HP-UX 11.23

Franz, Jay Jay.Franz at ssa.gov
Wed, 22 Aug 2007 16:40:06 -0400

I am attempting to compile iftop 0.17 on an HP Integrity (i.e., IA64)
server under HP-UX 11.23.  I am using the following GNU build

ar        :    GNU ar 2.17
as        :    GNU assembler 2.17
autoconf  :    autoconf (GNU Autoconf) 2.61
automake  :    automake (GNU automake) 1.10
bison     :    bison (GNU Bison) 2.3
flex      :    flex 2.5.33
gawk      :    GNU Awk 3.1.5
gcc       :    gcc (GCC) 4.1.2
make      :    GNU Make 3.81
nm        :    GNU nm 2.17
sed       :    GNU sed version 4.1.5
shtool    :    GNU shtool 2.0.7 (19-May-2007)

And, the following configure command:

CFLAGS=3D'-lpthread' CPPFLAGS=3D'-I /usr/local/include/ncurses' CC=3Dgcc

The CFLAGS parameter is required to overcome an error in configure, to
correctly identify the threads capability in HP-UX.

The CPPFLAGS parameter is required to overcome an error in make, to
correctly located the ncurses library.

The command results in the following make error:

source=3D'addrs_dlpi.c' object=3D'addrs_dlpi.o' libtool=3Dno \
        depfile=3D'.deps/addrs_dlpi.Po' =
        depmode=3Dgcc3 /bin/sh ./config/depcomp \
        gcc -DHAVE_CONFIG_H -I. -I. -I.   -I /usr/local/include/ncurses
-lpthread  -c `test -f 'addrs_dlpi.c' || echo './'`a
addrs_dlpi.c:24:24: error: sys/sockio.h: No such file or directory
addrs_dlpi.c:53: warning: 'struct in_addr' declared inside parameter
addrs_dlpi.c:53: warning: its scope is only this definition or
declaration, which is probably not what you want
addrs_dlpi.c: In function 'get_addrs_dlpi':
addrs_dlpi.c:184: error: dereferencing pointer to incomplete type
addrs_dlpi.c:190: error: dereferencing pointer to incomplete type
addrs_dlpi.c:190: error: invalid application of 'sizeof' to incomplete
type 'struct in_addr'
make[2]: *** [addrs_dlpi.o] Error 1
make[2]: Leaving directory `/usr/local/install/iftop-0.17'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/install/iftop-0.17'
make: *** [all] Error 2

The first error, regarding the 'sys/sockio.h' header can be overcome by
removing the include from the addrs_dlpi.c source, since, according to
HP, the socket ioctl definitions are defined in the
/usr/include/sys/ioctl.h' header file, which is included in the
addrs_dlpi.c source.  However, removing the 'sys/sockio.h' reference
only resolves the first error; the other errors, regarding the pointer
dereferencing and the type application remain.

The section of addrs_dlpi.c code apparently generating the errors looks

   178  #ifdef SIOCGIFADDR
   180    fd =3D socket(PF_INET, SOCK_DGRAM, 0); /* any sort of IP =
will do */
   182    strncpy(ifr.ifr_name, interface, IFNAMSIZ);
   184    (*(struct sockaddr_in *) &ifr.ifr_addr).sin_family =3D =
   186    if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) {
   187      fprintf(stderr, "Error getting IP address for interface:
%s\n", "ge0");
   188      perror("ioctl(SIOCGIFADDR)");
   189    } else {
   190      memcpy(if_ip_addr, &((*(struct sockaddr_in *)
&ifr.ifr_addr).sin_addr), sizeof(struct in_addr));
   191      got_ip_addr =3D 2;
   192    }
   193  #else
   194    fprintf(stderr, "Cannot obtain IP address on this
   195  #endif

Although the warnings appear to reference the structure definition
generating the errors:

    52  int
    53  get_addrs_dlpi(char *interface, char if_hw_addr[], struct
in_addr *if_ip_addr)
    54  {
    55    int got_hw_addr =3D 0;
    56    int got_ip_addr =3D 0;

Any ideas as to where to go next?  Any help would be appreciated.

Jay Franz