cc -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.
rick jones
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.