Skip to contentSkip to conversation

Missing definition of struct "pkt_buff" for libnetfilter_queue

DISCUSSION Shockedder 2 participants 3 messages Nov 16, 2022 1 message not in the archive netfilter

lore
Share & tools
lore

Shockedder

author
#0 lore raw

Hello,

I'm running with a slightly older version of "libnetfilter_queue" (1.0.2).

I have installed both the standard and devel packages, along with the same for "libnfnetlink" I can't for the life of me find the definition of "struct pkt_buff" in any of the source or headers.

Due to that I'm getting errors when trying to compile accessing structure members:

"etf_nq.c:78:93: error: dereferencing pointer to incomplete type ‘struct pkt_buff’
       fprintf(stdout,"[PACKET] UDP pB->th pointer val=%p pktb_tail pointer val=%p\n",pktBuff->transport_header,pktb_tail(pktBuff));"

And also having issues accessing the payload for UDP (null pointer exception).

What am I missing ? Does something else also needs to be installed ?

Please help.

Kind regards,

   -V

#1 lore raw
Quoted 6 lines · Shockedder

I'm running with a slightly older version of "libnetfilter_queue" (1.0.2).

I have installed both the standard and devel packages, along with the same for "libnfnetlink" I can't for the life of me find the definition of "struct pkt_buff" in any of the source or headers.

https://git.netfilter.org/libnetfilter_queue/tree/src/internal.h?h=libnetfilter_queue-1.0.2

The public API for struct pkg_buff is:

https://git.netfilter.org/libnetfilter_queue/tree/include/libnetfilter_queue/pktbuff.h?h=libnetfilter_queue-1.0.2

Quoted 5 lines

Due to that I'm getting errors when trying to compile accessing structure members:

"etf_nq.c:78:93: error: dereferencing pointer to incomplete type ‘struct pkt_buff’
       fprintf(stdout,"[PACKET] UDP pB->th pointer val=%p pktb_tail pointer val=%p\n",pktBuff->transport_header,pktb_tail(pktBuff));"

Try:

fprintf(stdout,"[PACKET] UDP pB->th pointer val=%p pktb_tail pointer val=%p\n",
(void *) pktb_transport_header(pktBuff), pktb_tail(pktBuff));"

Quoted 5 lines

And also having issues accessing the payload for UDP (null pointer exception).

What am I missing ? Does something else also needs to be installed ?

J.

A message that is not in the archive (sent off-list or not yet received): CAC8-Yrfhz4KU29MP7COyshgQnAa13u1xe6FxzgBkxu+Dxh-mzg@mail.gmail.com

#3 lore raw
Quoted 26 lines · shockedder shockedder
Quoted 17 lines · Jeremy Sowden
Quoted 6 lines · Shockedder

I'm running with a slightly older version of "libnetfilter_queue" (1.0.2).

I have installed both the standard and devel packages, along with the same for "libnfnetlink" I can't for the life of me find the definition of "struct pkt_buff" in any of the source or headers.

https://git.netfilter.org/libnetfilter_queue/tree/src/internal.h?h=libnetfilter_queue-1.0.2

The public API for struct [pkt_buff] is:

https://git.netfilter.org/libnetfilter_queue/tree/include/libnetfilter_queue/pktbuff.h?h=libnetfilter_queue-1.0.2

Quoted 3 lines

Due to that I'm getting errors when trying to compile accessing structure members:

Quoted 7 lines
Quoted 2 lines

"etf_nq.c:78:93: error: dereferencing pointer to incomplete type 'struct pkt_buff'

       fprintf(stdout,"[PACKET] UDP pB->th pointer val=%p pktb_tail pointer val=%p\n",pktBuff->transport_header,pktb_tail(pktBuff));"

Try:

fprintf(stdout,"[PACKET] UDP pB->th pointer val=%p pktb_tail pointer val=%p\n",
(void *) pktb_transport_header(pktBuff), pktb_tail(pktBuff));"

Quoted 6 lines

Thank you very much, you've saved me a lot of hair-pulling. Looking once more, I've been able to find that header file in the source download for "libnetfilter_queue".

However it is not present in the standard lib and devel packages hence the initial issue. Is there a reason for this ?

Encapsulation:

https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)#Information_hiding

Quoted 1 line

Is it a bug ?

Since the internal structure of struct pkt_buff is intended to be private, and the header file is only necessary to build the library itself, there is no need to include it in the binary packages. For those developing against the library, the public API in libnetfilter_queue/pktbuff.h will be present in the devel package.

J.