tcpdump mailing list archives

libpcap/TCPDump issues on HP-UX 11.0


From: "Lynne Seamans" <Lynne.Seamans () millersville edu>
Date: Wed, 6 Sep 2006 09:34:38 -0400

I recently had occasion to compile libpcap/tcpdump on an 11.0 system,
and had to do the following:
------------------------------------------------------------------------
--------------------------
A) PROBLEM: (libpcap) said lex was "insufficient"

A) SOLUTION: from Rick Jones:

   Go into the configure script and look for "insufficient" and you
should see something like:

echo $ECHO_N "checking for capable lex... $ECHO_C" >&6
if test "${tcpdump_cv_capable_lex+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if lex -t scanner.l > /dev/null 2>&1; then
tcpdump_cv_capable_lex=yes
else
tcpdump_cv_capable_lex=insufficient
fi
fi

run that lex command by hand. You will probably see something like:

...
"scanner.l" line 349: error 4: Parse tree too big
6000/6000 nodes(%e), 0/25000 positions(%p), 1/2000 (%n), 0 transitions,
0/4000 packed char classes(%k), 0/16000 packed transitions(%a), 0/19000
output slots(%o)

Notice the bit about "nodes(%e)" - go into scanner.l and change the %e
to something larger. You should see something akin to:

...
6056/9000 nodes(%e), 22089/25000 positions(%p), 1312/2000 (%n), 48325
transitions, 3621/4000 packed char classes(%k), 14716/16000 packed
transitions(%a), 17206/19000 output slots(%o)

and re-run configure and all should be well.

It was, when one configured --without-gcc

------------------------------------------------------------------------
--------------------------

B) PROBLEM (tcpdump):
        print-dccp.c compile fails "Cannot do arithmetic with pointers
to objects of unknown size." compiling tcpdump

B) SOLUTION:  also from Rick Jones 

c -O -DHAVE_CONFIG_H -I./../libpcap-2005.10.09 -I/usr/local/include
-I/usr//include -I./missing -D_U_="" -I. -I./../libpcap-2005.10.09
-I/usr/local/include -I/usr//include -I./missing -c ./print-dccp.c
cc: "print-dccp.c", line 149: error 1539: Cannot do arithmetic with
pointers to objects of unknown size.
*** Error exit code 1

the offensive code :)


static u_int64_t dccp_seqno(const struct dccp_hdr *dh)
{
        u_int32_t seq_high = DCCPH_SEQ(dh);
        u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;


        if (DCCPH_X(dh) != 0) {
                const struct dccp_hdr_ext *dhx = (void *)dh +
sizeof(*dh);
                u_int32_t seq_low = dhx->dccph_seq_low;
                seqno &= 0x00FFFF;  /* clear reserved field */
                seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);
        }


        return seqno;
}


specifically the "const struct dccp_hdr_ext..." There seems to be a
dccp.h, and it has that field:

/**
 * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
 *
 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
 */
struct dccp_hdr_ext {
        u_int32_t       dccph_seq_low;
};


It seems the compiler I have didn't like the + sizeof(*dh) in the
declaration. If I change that to be on a separate line it appears to
compile:

$ diff -c print-dccp.c.orig print-dccp.c
*** print-dccp.c.orig   Mon Sep 19 23:25:20 2005
--- print-dccp.c        Mon Nov  7 13:20:14 2005
***************
*** 146,152 ****
        u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;


        if (DCCPH_X(dh) != 0) {
!               const struct dccp_hdr_ext *dhx = (void *)dh +
sizeof(*dh);
                u_int32_t seq_low = dhx->dccph_seq_low;
                seqno &= 0x00FFFF;  /* clear reserved field */
                seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);
--- 146,153 ----
        u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;


        if (DCCPH_X(dh) != 0) {
!               const struct dccp_hdr_ext *dhx = (void *)dh;
!               dhx += sizeof(*dh);
                u_int32_t seq_low = dhx->dccph_seq_low;
                seqno &= 0x00FFFF;  /* clear reserved field */
                seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);


probably a bug in the compiler - perhaps even one that has been fixed in
a compiler patch or later version, but I thought I might send-along the
patch just the same.

------------------------------------------------------------------------
--------------------------

C)  PROBLEM (tcpdump):

compile error for print-isoclns.c compiling tcpdump as follows:
cc: "print-isoclns.c", line 1619: error 1594: The sizeof operator cannot
be applied to types with unknown size.
cc: "print-isoclns.c", line 1649: error 1594: The sizeof operator cannot
be applied to types with unknown size.

*** Error exit code 1

It looks like "in6_addr" is the variable, and it seems to be talked
about in ip6 areas of code.

C)  SOLUTION:

HP-UX 11.0 doesn't really support IPv6, so no-oped that module, and
finally got a "tcpdump" executable.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: