Skip to contentSkip to conversation

Gcc error trying to use nf_conntrack->id (dereferencing pointer to incomplete type)

PATCH Italo Valcy 2 participants 3 messages Oct 16, 2010

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

I'm trying to use 'id' field of nf_conntrack struct but I'm getting the following error: "dereferencing pointer to incomplete type".

For example, I've tried to modify conntrack-0.9.6 to print this 'id' field when "Display a real-time event log":

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

(quoted diff) +0 -0

b/conntrack-0.9.6/src/conntrack.c
index 82ff544..8b74564 100644
- --- a/conntrack.c
+++ b/conntrack.c
@@ -603,7 +603,7 @@ static int event_cb(enum nf_conntrack_msg_type type,

        }

        nfct_snprintf(buf, 1024, ct, type, output_type, output_flags);
- -       printf("%s\n", buf);
+       printf("%s id=%u\n", buf, ct->id);
        fflush(stdout);

        return NFCT_CB_CONTINUE;

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

And tried to compile with gcc 4.3:

- -------------------------
gcc -DPACKAGE_NAME=\"conntrack-tools\"
- -DPACKAGE_TARNAME=\"conntrack-tools\" -DPACKAGE_VERSION=\"0.9.6\"
- -DPACKAGE_STRING=\"conntrack-tools\ 0.9.6\"
- -DPACKAGE_BUGREPORT=\"[email protected]\"
- -DPACKAGE=\"conntrack-tools\" -DVERSION=\"0.9.6\" -DSTDC_HEADERS=1
- -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
- -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
- -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
- -DYYTEXT_POINTER=1 -DHAVE_LINUX_CAPABILITY_H=1 -DHAVE_LIBNFNETLINK=1
- -DHAVE_LIBNETFILTER_CONNTRACK=1 -DHAVE_ARPA_INET_H=1 -DHAVE_INET_PTON=1
- -DHAVE_INET_PTON_IPV6=1 -I. -I../include -std=gnu99 -W -Wall -Werror
- -Wmissing-prototypes -Wwrite-strings -Wcast-qual -Wfloat-equal -Wshadow
- -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return
- -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline
- -Wstrict-prototypes -Wundef -Wno-unused-parameter -g -O2 -MT
conntrack.o -MD -MP -MF .deps/conntrack.Tpo -c -o conntrack.o conntrack.c conntrack.c: In function ‘event_cb’:
conntrack.c:606: error: dereferencing pointer to incomplete type
make: ** [conntrack.o] Erro 1
- -------------------------

My gcc version:

~$ gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Please, any ideas about what I'm doing wrong?

Thanks for any help!

- --
Saudações,

Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky5+s8ACgkQfidLqjN6RNHnsQCfVXWpecEHf07HJItjye4tNFyB RXcAoJuxpwsrlpy3EbaFrm7VjIgl5myu
=sPwU
-----END PGP SIGNATURE-----

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

Em 16-10-2010 16:19, Italo Valcy escreveu:

Quoted 3 lines

I'm trying to use 'id' field of nf_conntrack struct but I'm getting the following error: "dereferencing pointer to incomplete type".

Forget about: I'll use nfct_get_attr_u32()

Thanks.

- --
Saudações,

Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky6C4AACgkQfidLqjN6RNHL2gCeJWejnQS4i+2kUD8FTyUgFx0U xO4AoJErwOZWOeefQvwFZMc09C3fh/3O
=T65x
-----END PGP SIGNATURE-----

#2 lore raw
In reply to Italo Valcy
Quoted 5 lines · Italo Valcy

I'm trying to use 'id' field of nf_conntrack struct but I'm getting the following error: "dereferencing pointer to incomplete type".

For example, I've tried to modify conntrack-0.9.6 to print this 'id' field when "Display a real-time event log":

Unrelated to your issue though, it is usually wise to work with the most recently released tarball.