All of lore.kernel.org
 help / color / mirror / Atom feed
* Documentation oddity.
@ 2024-12-18 15:20 G.W. Haywood
  2024-12-19  9:22 ` Jozsef Kadlecsik
  0 siblings, 1 reply; 10+ messages in thread
From: G.W. Haywood @ 2024-12-18 15:20 UTC (permalink / raw)
  To: netfilter-devel

Hi there,

In the 'man' pages for 'ipset' on my systems, and at

https://ipset.netfilter.org/ipset.man.html

one sees

[quote]
netmask cidr
     When the optional netmask parameter specified, network addresses
     will be stored in the set instead of IP host addresses. The cidr
     prefix value must be between 1-32. [...]
[/quote]

I've just used a value of 64 for an IPv6 set.  It seems to work. :)

Have I missed something, or is the documentation in need of an update?

-- 

73,
Ged.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2024-12-18 15:20 Documentation oddity G.W. Haywood
@ 2024-12-19  9:22 ` Jozsef Kadlecsik
  2025-03-10 18:00   ` G.W. Haywood
  0 siblings, 1 reply; 10+ messages in thread
From: Jozsef Kadlecsik @ 2024-12-19  9:22 UTC (permalink / raw)
  To: G.W. Haywood; +Cc: netfilter-devel

Hi,

On Wed, 18 Dec 2024, G.W. Haywood wrote:

> In the 'man' pages for 'ipset' on my systems, and at
>
> https://ipset.netfilter.org/ipset.man.html
>
> one sees
>
> [quote]
> netmask cidr
>    When the optional netmask parameter specified, network addresses
>    will be stored in the set instead of IP host addresses. The cidr
>    prefix value must be between 1-32. [...]
> [/quote]
>
> I've just used a value of 64 for an IPv6 set.  It seems to work. :)
>
> Have I missed something, or is the documentation in need of an update?

The manpage is uptodate - the webpage version was not refreshed.
Now it's done and it reflects the reality :-)

Best regards,
Jozsef
-- 
E-mail : kadlec@netfilter.org, kadlec@blackhole.kfki.hu,
          kadlecsik.jozsef@wigner.hu
Address: Wigner Research Centre for Physics
          H-1525 Budapest 114, POB. 49, Hungary

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2024-12-19  9:22 ` Jozsef Kadlecsik
@ 2025-03-10 18:00   ` G.W. Haywood
  2025-03-11  0:00     ` Duncan Roe
  0 siblings, 1 reply; 10+ messages in thread
From: G.W. Haywood @ 2025-03-10 18:00 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: netfilter-devel

Hi there,

Another one for you.

In the docs at

https://www.netfilter.org/projects/libnetfilter_queue/doxygen/html/

there is given a command to compile the sample code in nf-queue.c.

The command given is

gcc -g3 -ggdb -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c

Here, and I suspect almost everywhere else, that doesn't work.

Should the command not be something more like the one below?

gcc -o nf-queue nf-queue.c -g3 -ggdb -Wall -lmnl -lnetfilter_queue

-- 

73,
Ged.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-10 18:00   ` G.W. Haywood
@ 2025-03-11  0:00     ` Duncan Roe
  2025-03-11 10:00       ` G.W. Haywood
  0 siblings, 1 reply; 10+ messages in thread
From: Duncan Roe @ 2025-03-11  0:00 UTC (permalink / raw)
  To: G.W. Haywood; +Cc: Netfilter Development, Jozsef Kadlecsik

Hi Ged,

On Mon, Mar 10, 2025 at 06:00:40PM +0000, G.W. Haywood wrote:
> Hi there,
>
> Another one for you.
>
> In the docs at
>
> https://www.netfilter.org/projects/libnetfilter_queue/doxygen/html/
>
> there is given a command to compile the sample code in nf-queue.c.
>
> The command given is
>
> gcc -g3 -ggdb -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
>
> Here, and I suspect almost everywhere else, that doesn't work.

Works here with gcc versions 11.2.0 and 14.2.0.
>
> Should the command not be something more like the one below?
>
> gcc -o nf-queue nf-queue.c -g3 -ggdb -Wall -lmnl -lnetfilter_queue

gcc doesn't care, but the conventional order for command arguments is option
args first, as in the docs.
>
The -ggdb argument is obsolete and may be slated for removal. Can you please try
this:

gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c

If it still fails for you, please let me know at least 2 things:

1. What is the error message

2. The first line output bu the command "gcc --version"

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-11  0:00     ` Duncan Roe
@ 2025-03-11 10:00       ` G.W. Haywood
  2025-03-12  6:21         ` Duncan Roe
  0 siblings, 1 reply; 10+ messages in thread
From: G.W. Haywood @ 2025-03-11 10:00 UTC (permalink / raw)
  To: Duncan Roe; +Cc: Netfilter Development

Hi Duncan,

Thanks for the reply.

On Tue, 11 Mar 2025, Duncan Roe wrote:
> On Mon, Mar 10, 2025 at 06:00:40PM +0000, G.W. Haywood wrote:
>> ...
>> In the docs at
>>
>> https://www.netfilter.org/projects/libnetfilter_queue/doxygen/html/
>>
>> there is given a command to compile the sample code in nf-queue.c.
>>
>> The command given is
>>
>> gcc -g3 -ggdb -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
>>
>> Here, and I suspect almost everywhere else, that doesn't work.
>
> Works here with gcc versions 11.2.0 and 14.2.0.

Debian 11, gcc version 10.2.1-6 here.

>> Should the command not be something more like the one below?
>>
>> gcc -o nf-queue nf-queue.c -g3 -ggdb -Wall -lmnl -lnetfilter_queue
>
> gcc doesn't care, but the conventional order for command arguments is option
> args first, as in the docs.

That's what I'd always thought - until I tried to do what it said
there, searched stackoverflow for similar issues, and found them. :/

> The -ggdb argument is obsolete and may be slated for removal. Can you please try
> this:
>
> gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c

Same problem exactly.

> If it still fails for you, please let me know at least 2 things:
>
> 1. What is the error message

8<----------------------------------------------------------------------
$ gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
/usr/bin/ld: /tmp/ccbLJv89.o: in function `nfq_send_verdict':
/home/ged/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:31: undefined reference to `nfq_nlmsg_verdict_put'
/usr/bin/ld: /home/ged/nf-queue.c:34: undefined reference to `mnl_attr_nest_start'
/usr/bin/ld: /home/ged/nf-queue.c:37: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:41: undefined reference to `mnl_attr_nest_end'
/usr/bin/ld: /home/ged/nf-queue.c:43: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /tmp/ccbLJv89.o: in function `queue_cb':
/home/ged/nf-queue.c:60: undefined reference to `nfq_nlmsg_parse'
/usr/bin/ld: /home/ged/nf-queue.c:65: undefined reference to `mnl_nlmsg_get_payload'
/usr/bin/ld: /home/ged/nf-queue.c:75: undefined reference to `mnl_attr_get_payload'
/usr/bin/ld: /home/ged/nf-queue.c:78: undefined reference to `mnl_attr_get_payload_len'
/usr/bin/ld: /home/ged/nf-queue.c:93: undefined reference to `mnl_attr_get_u32'
/usr/bin/ld: /home/ged/nf-queue.c:97: undefined reference to `mnl_attr_get_u32'
/usr/bin/ld: /home/ged/nf-queue.c:111: undefined reference to `mnl_attr_get_payload'
/usr/bin/ld: /tmp/ccbLJv89.o: in function `main':
/home/ged/nf-queue.c:162: undefined reference to `mnl_socket_open'
/usr/bin/ld: /home/ged/nf-queue.c:168: undefined reference to `mnl_socket_bind'
/usr/bin/ld: /home/ged/nf-queue.c:172: undefined reference to `mnl_socket_get_portid'
/usr/bin/ld: /home/ged/nf-queue.c:184: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:185: undefined reference to `nfq_nlmsg_cfg_put_cmd'
/usr/bin/ld: /home/ged/nf-queue.c:187: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /home/ged/nf-queue.c:195: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:196: undefined reference to `nfq_nlmsg_cfg_put_params'
/usr/bin/ld: /home/ged/nf-queue.c:198: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:199: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:201: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /home/ged/nf-queue.c:211: undefined reference to `mnl_socket_setsockopt'
/usr/bin/ld: /home/ged/nf-queue.c:217: undefined reference to `mnl_socket_recvfrom'
/usr/bin/ld: /home/ged/nf-queue.c:223: undefined reference to `mnl_cb_run'
collect2: error: ld returned 1 exit status
8<----------------------------------------------------------------------

8<----------------------------------------------------------------------
$ gcc -o nf-queue nf-queue.c -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue
$ 
8<----------------------------------------------------------------------

8<----------------------------------------------------------------------
$ !84038
gcc -g3 -ggdb -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
/usr/bin/ld: /tmp/ccPlG4la.o: in function `nfq_send_verdict':
/home/ged/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:31: undefined reference to `nfq_nlmsg_verdict_put'
/usr/bin/ld: /home/ged/nf-queue.c:34: undefined reference to `mnl_attr_nest_start'
/usr/bin/ld: /home/ged/nf-queue.c:37: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:41: undefined reference to `mnl_attr_nest_end'
/usr/bin/ld: /home/ged/nf-queue.c:43: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /tmp/ccPlG4la.o: in function `queue_cb':
/home/ged/nf-queue.c:60: undefined reference to `nfq_nlmsg_parse'
/usr/bin/ld: /home/ged/nf-queue.c:65: undefined reference to `mnl_nlmsg_get_payload'
/usr/bin/ld: /home/ged/nf-queue.c:75: undefined reference to `mnl_attr_get_payload'
/usr/bin/ld: /home/ged/nf-queue.c:78: undefined reference to `mnl_attr_get_payload_len'
/usr/bin/ld: /home/ged/nf-queue.c:93: undefined reference to `mnl_attr_get_u32'
/usr/bin/ld: /home/ged/nf-queue.c:97: undefined reference to `mnl_attr_get_u32'
/usr/bin/ld: /home/ged/nf-queue.c:111: undefined reference to `mnl_attr_get_payload'
/usr/bin/ld: /tmp/ccPlG4la.o: in function `main':
/home/ged/nf-queue.c:162: undefined reference to `mnl_socket_open'
/usr/bin/ld: /home/ged/nf-queue.c:168: undefined reference to `mnl_socket_bind'
/usr/bin/ld: /home/ged/nf-queue.c:172: undefined reference to `mnl_socket_get_portid'
/usr/bin/ld: /home/ged/nf-queue.c:184: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:185: undefined reference to `nfq_nlmsg_cfg_put_cmd'
/usr/bin/ld: /home/ged/nf-queue.c:187: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /home/ged/nf-queue.c:195: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/nf-queue.c:196: undefined reference to `nfq_nlmsg_cfg_put_params'
/usr/bin/ld: /home/ged/nf-queue.c:198: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:199: undefined reference to `mnl_attr_put_u32'
/usr/bin/ld: /home/ged/nf-queue.c:201: undefined reference to `mnl_socket_sendto'
/usr/bin/ld: /home/ged/nf-queue.c:211: undefined reference to `mnl_socket_setsockopt'
/usr/bin/ld: /home/ged/nf-queue.c:217: undefined reference to `mnl_socket_recvfrom'
/usr/bin/ld: /home/ged/nf-queue.c:223: undefined reference to `mnl_cb_run'
collect2: error: ld returned 1 exit status
$ 
8<----------------------------------------------------------------------

This is where I'd got to when I sent the OP:

8<----------------------------------------------------------------------
$ !84039
gcc -o nf-queue nf-queue.c -g3 -ggdb -Wall -lmnl -lnetfilter_queue
$
8<----------------------------------------------------------------------

> 2. The first line output by the command "gcc --version"

$ gcc --version | head -n1
gcc (Debian 10.2.1-6) 10.2.1 20210110

This is a raspberry Pi4B, 8GBytes, 64 bit.

8<----------------------------------------------------------------------
$ uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
$ 
8<----------------------------------------------------------------------

There were other problems when I tried the same thing on x86, but that
was gcc version 8, so I think they can be ignored.

Thanks again.  Please note that this isn't a problem for me - it's
just me trying to get docs in order whenever I see something odd.

-- 

73,
Ged.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-11 10:00       ` G.W. Haywood
@ 2025-03-12  6:21         ` Duncan Roe
  2025-03-12  9:48           ` G.W. Haywood
  2025-03-28 13:55           ` G.W. Haywood
  0 siblings, 2 replies; 10+ messages in thread
From: Duncan Roe @ 2025-03-12  6:21 UTC (permalink / raw)
  To: G.W. Haywood; +Cc: Netfilter Development

Hi Ged,

On Tue, Mar 11, 2025 at 10:00:04AM +0000, G.W. Haywood wrote:
>
> Debian 11, gcc version 10.2.1-6 here.
>
> 8<----------------------------------------------------------------------
> $ gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
> /usr/bin/ld: /tmp/ccbLJv89.o: in function `nfq_send_verdict':
> /home/ged/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
> /usr/bin/ld: /home/ged/nf-queue.c:31: undefined reference to `nfq_nlmsg_verdict_put'
> /usr/bin/ld: /home/ged/nf-queue.c:34: undefined reference to `mnl_attr_nest_start'
> /usr/bin/ld: /home/ged/nf-queue.c:37: undefined reference to `mnl_attr_put_u32'
> /usr/bin/ld: /home/ged/nf-queue.c:41: undefined reference to `mnl_attr_nest_end'
> /usr/bin/ld: /home/ged/nf-queue.c:43: undefined reference to `mnl_socket_sendto'
> /usr/bin/ld: /tmp/ccbLJv89.o: in function `queue_cb':
> /home/ged/nf-queue.c:60: undefined reference to `nfq_nlmsg_parse'
> /usr/bin/ld: /home/ged/nf-queue.c:65: undefined reference to `mnl_nlmsg_get_payload'
> /usr/bin/ld: /home/ged/nf-queue.c:75: undefined reference to `mnl_attr_get_payload'
> /usr/bin/ld: /home/ged/nf-queue.c:78: undefined reference to `mnl_attr_get_payload_len'
> /usr/bin/ld: /home/ged/nf-queue.c:93: undefined reference to `mnl_attr_get_u32'
> /usr/bin/ld: /home/ged/nf-queue.c:97: undefined reference to `mnl_attr_get_u32'
> /usr/bin/ld: /home/ged/nf-queue.c:111: undefined reference to `mnl_attr_get_payload'
> /usr/bin/ld: /tmp/ccbLJv89.o: in function `main':
> /home/ged/nf-queue.c:162: undefined reference to `mnl_socket_open'
> /usr/bin/ld: /home/ged/nf-queue.c:168: undefined reference to `mnl_socket_bind'
> /usr/bin/ld: /home/ged/nf-queue.c:172: undefined reference to `mnl_socket_get_portid'
> /usr/bin/ld: /home/ged/nf-queue.c:184: undefined reference to `nfq_nlmsg_put'
> /usr/bin/ld: /home/ged/nf-queue.c:185: undefined reference to `nfq_nlmsg_cfg_put_cmd'
> /usr/bin/ld: /home/ged/nf-queue.c:187: undefined reference to `mnl_socket_sendto'
> /usr/bin/ld: /home/ged/nf-queue.c:195: undefined reference to `nfq_nlmsg_put'
> /usr/bin/ld: /home/ged/nf-queue.c:196: undefined reference to `nfq_nlmsg_cfg_put_params'
> /usr/bin/ld: /home/ged/nf-queue.c:198: undefined reference to `mnl_attr_put_u32'
> /usr/bin/ld: /home/ged/nf-queue.c:199: undefined reference to `mnl_attr_put_u32'
> /usr/bin/ld: /home/ged/nf-queue.c:201: undefined reference to `mnl_socket_sendto'
> /usr/bin/ld: /home/ged/nf-queue.c:211: undefined reference to `mnl_socket_setsockopt'
> /usr/bin/ld: /home/ged/nf-queue.c:217: undefined reference to `mnl_socket_recvfrom'
> /usr/bin/ld: /home/ged/nf-queue.c:223: undefined reference to `mnl_cb_run'
> collect2: error: ld returned 1 exit status
> 8<----------------------------------------------------------------------
>
nf-queue.c has compiled fine.

There is a problem with the shared libraries libmnl.so and
libnetfilter_queue.so. Those 2 libraries should satisfy the mnl_ and nfq_
references respectively.

On my (Slackware x86_64) system, "nm -D /usr/lib64/libmnl.so|grep -Ew T" gives:
| 0000000000003687 T mnl_attr_get_len@@LIBMNL_1.0
| 00000000000036ac T mnl_attr_get_payload@@LIBMNL_1.0
| 0000000000003698 T mnl_attr_get_payload_len@@LIBMNL_1.0
| ...
for a total of 68 lines. What do you get? (you may have to put /usr/lib instead
of /usr/lib64).
>
> $ gcc --version | head -n1
> gcc (Debian 10.2.1-6) 10.2.1 20210110

Same as my Debian 11.5 VM.
>
> This is a raspberry Pi4B, 8GBytes, 64 bit.
>
> 8<----------------------------------------------------------------------
> $ uname -a
> Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
> $ 8<----------------------------------------------------------------------

Looks like an arm-specific problem. nm output should tell us more.
>
> There were other problems when I tried the same thing on x86, but that
> was gcc version 8, so I think they can be ignored.

gcc-8 should be fine. Please document these problems also.

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-12  6:21         ` Duncan Roe
@ 2025-03-12  9:48           ` G.W. Haywood
  2025-03-13 10:04             ` Duncan Roe
  2025-03-28 13:55           ` G.W. Haywood
  1 sibling, 1 reply; 10+ messages in thread
From: G.W. Haywood @ 2025-03-12  9:48 UTC (permalink / raw)
  To: Duncan Roe; +Cc: Netfilter Development

[-- Attachment #1: Type: text/plain, Size: 10665 bytes --]

Hi Duncan,

On Wed, 12 Mar 2025, Duncan Roe wrote:
> On Tue, Mar 11, 2025 at 10:00:04AM +0000, G.W. Haywood wrote:
>>
>> Debian 11, gcc version 10.2.1-6 here.
>>
>> 8<----------------------------------------------------------------------
>> $ gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
>> /usr/bin/ld: /tmp/ccbLJv89.o: in function `nfq_send_verdict':
>> /home/ged/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
>> ...
>> ...
>> collect2: error: ld returned 1 exit status
>> 8<----------------------------------------------------------------------
>>
> nf-queue.c has compiled fine.

Quite so, but it hasn't linked and no executable has been produced... :/

However, with the object and source file args at the beginning of the
command line, there are no linker errors and the executable is produced.

> There is a problem with the shared libraries libmnl.so and
> libnetfilter_queue.so. Those 2 libraries should satisfy the mnl_ and nfq_
> references respectively.

Obviously I do have them installed.

> On my (Slackware x86_64) system, "nm -D /usr/lib64/libmnl.so|grep -Ew T" gives:
> | 0000000000003687 T mnl_attr_get_len@@LIBMNL_1.0
> | 00000000000036ac T mnl_attr_get_payload@@LIBMNL_1.0
> | 0000000000003698 T mnl_attr_get_payload_len@@LIBMNL_1.0
> | ...
> for a total of 68 lines. What do you get? (you may have to put /usr/lib instead
> of /usr/lib64).

The libraries are in /usr/lib/aarch64-linux-gnu/, and yes, 68 lines output:

8<----------------------------------------------------------------------

$ nm -D /usr/lib/aarch64-linux-gnu/libmnl.so|grep -Ew T | head
0000000000002ad8 T mnl_attr_get_len@@LIBMNL_1.0
0000000000002af0 T mnl_attr_get_payload@@LIBMNL_1.0
0000000000002ae0 T mnl_attr_get_payload_len@@LIBMNL_1.0
0000000000002f20 T mnl_attr_get_str@@LIBMNL_1.0
0000000000002ac8 T mnl_attr_get_type@@LIBMNL_1.0
0000000000002ed8 T mnl_attr_get_u16@@LIBMNL_1.0
0000000000002ef0 T mnl_attr_get_u32@@LIBMNL_1.0
0000000000002f08 T mnl_attr_get_u64@@LIBMNL_1.0
0000000000002ec0 T mnl_attr_get_u8@@LIBMNL_1.0
00000000000032a0 T mnl_attr_nest_cancel@@LIBMNL_1.0
0000000000003278 T mnl_attr_nest_end@@LIBMNL_1.0
00000000000030a8 T mnl_attr_nest_start@@LIBMNL_1.0
0000000000003250 T mnl_attr_nest_start_check@@LIBMNL_1.0
0000000000002c30 T mnl_attr_next@@LIBMNL_1.0
0000000000002c00 T mnl_attr_ok@@LIBMNL_1.0
0000000000002d08 T mnl_attr_parse@@LIBMNL_1.0
0000000000002da0 T mnl_attr_parse_nested@@LIBMNL_1.0
0000000000002e40 T mnl_attr_parse_payload@@LIBMNL_1.1
0000000000002f28 T mnl_attr_put@@LIBMNL_1.0
00000000000030e0 T mnl_attr_put_check@@LIBMNL_1.0
0000000000003018 T mnl_attr_put_str@@LIBMNL_1.0
00000000000031b0 T mnl_attr_put_str_check@@LIBMNL_1.0
0000000000003060 T mnl_attr_put_strz@@LIBMNL_1.0
0000000000003200 T mnl_attr_put_strz_check@@LIBMNL_1.0
0000000000002fb8 T mnl_attr_put_u16@@LIBMNL_1.0
0000000000003150 T mnl_attr_put_u16_check@@LIBMNL_1.0
0000000000002fd8 T mnl_attr_put_u32@@LIBMNL_1.0
0000000000003170 T mnl_attr_put_u32_check@@LIBMNL_1.0
0000000000002ff8 T mnl_attr_put_u64@@LIBMNL_1.0
0000000000003190 T mnl_attr_put_u64_check@@LIBMNL_1.0
0000000000002f98 T mnl_attr_put_u8@@LIBMNL_1.0
0000000000003130 T mnl_attr_put_u8_check@@LIBMNL_1.0
0000000000002c48 T mnl_attr_type_valid@@LIBMNL_1.0
0000000000002c98 T mnl_attr_validate@@LIBMNL_1.0
0000000000002cd8 T mnl_attr_validate2@@LIBMNL_1.0
00000000000022f8 T mnl_cb_run@@LIBMNL_1.0
0000000000002168 T mnl_cb_run2@@LIBMNL_1.0
0000000000002ab0 T mnl_nlmsg_batch_current@@LIBMNL_1.0
0000000000002aa8 T mnl_nlmsg_batch_head@@LIBMNL_1.0
0000000000002ab8 T mnl_nlmsg_batch_is_empty@@LIBMNL_1.0
00000000000029f8 T mnl_nlmsg_batch_next@@LIBMNL_1.0
0000000000002a40 T mnl_nlmsg_batch_reset@@LIBMNL_1.0
0000000000002aa0 T mnl_nlmsg_batch_size@@LIBMNL_1.0
00000000000029b8 T mnl_nlmsg_batch_start@@LIBMNL_1.0
00000000000029f0 T mnl_nlmsg_batch_stop@@LIBMNL_1.0
0000000000002590 T mnl_nlmsg_fprintf@@LIBMNL_1.0
00000000000024c8 T mnl_nlmsg_get_payload@@LIBMNL_1.0
0000000000002470 T mnl_nlmsg_get_payload_len@@LIBMNL_1.0
00000000000024d0 T mnl_nlmsg_get_payload_offset@@LIBMNL_1.0
0000000000002548 T mnl_nlmsg_get_payload_tail@@LIBMNL_1.0
0000000000002518 T mnl_nlmsg_next@@LIBMNL_1.0
00000000000024e8 T mnl_nlmsg_ok@@LIBMNL_1.0
0000000000002578 T mnl_nlmsg_portid_ok@@LIBMNL_1.0
0000000000002490 T mnl_nlmsg_put_extra_header@@LIBMNL_1.0
0000000000002480 T mnl_nlmsg_put_header@@LIBMNL_1.0
0000000000002560 T mnl_nlmsg_seq_ok@@LIBMNL_1.0
0000000000002468 T mnl_nlmsg_size@@LIBMNL_1.0
0000000000001ec0 T mnl_socket_bind@@LIBMNL_1.0
0000000000002068 T mnl_socket_close@@LIBMNL_1.0
0000000000001e18 T mnl_socket_fdopen@@LIBMNL_1.2
0000000000001df8 T mnl_socket_get_fd@@LIBMNL_1.0
0000000000001e00 T mnl_socket_get_portid@@LIBMNL_1.0
00000000000020c0 T mnl_socket_getsockopt@@LIBMNL_1.0
0000000000001e08 T mnl_socket_open@@LIBMNL_1.0
0000000000001e10 T mnl_socket_open2@@LIBMNL_1.2
0000000000001fa0 T mnl_socket_recvfrom@@LIBMNL_1.0
0000000000001f88 T mnl_socket_sendto@@LIBMNL_1.0
00000000000020a0 T mnl_socket_setsockopt@@LIBMNL_1.0
$

8<----------------------------------------------------------------------

>> There were other problems when I tried the same thing on x86, but that
>> was gcc version 8, so I think they can be ignored.
>
> gcc-8 should be fine. Please document these problems also.

8<----------------------------------------------------------------------

# uname -a
Linux laptop3 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 GNU/Linux
# apt-get install libmnl-dev libmnl0 libnetfilter-queue-dev libnetfilter-queue1 libnftnl11 libnftnl-dev
Reading package lists... Done
Building dependency tree 
Reading state information... Done
libmnl-dev is already the newest version (1.0.4-2).
libmnl0 is already the newest version (1.0.4-2).
libnetfilter-queue-dev is already the newest version (1.0.3-1).
libnetfilter-queue1 is already the newest version (1.0.3-1).
libnftnl-dev is already the newest version (1.1.2-2).
libnftnl11 is already the newest version (1.1.2-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#

8<----------------------------------------------------------------------

8<----------------------------------------------------------------------

$ gcc -g3 -gdwarf-4 -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
nf-queue.c: In function ‘nfq_send_verdict’:
nf-queue.c:30:8: warning: implicit declaration of function ‘nfq_nlmsg_put’; did you mean ‘nfq_nlmsg_parse’? [-Wimplicit-function-declaration]
   nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, queue_num);
         ^~~~~~~~~~~~~
         nfq_nlmsg_parse
nf-queue.c:30:6: warning: assignment to ‘struct nlmsghdr *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, queue_num);
       ^
nf-queue.c: In function ‘main’:
nf-queue.c:184:6: warning: assignment to ‘struct nlmsghdr *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
       ^
nf-queue.c:195:6: warning: assignment to ‘struct nlmsghdr *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num);
       ^
/usr/bin/ld: /tmp/cc2fCm9v.o: in function `nfq_send_verdict':
/home/ged/Downloads/src/net/netfilter/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /tmp/cc2fCm9v.o: in function `main':
/home/ged/Downloads/src/net/netfilter/nf-queue.c:184: undefined reference to `nfq_nlmsg_put'
/usr/bin/ld: /home/ged/Downloads/src/net/netfilter/nf-queue.c:195: undefined reference to `nfq_nlmsg_put'
collect2: error: ld returned 1 exit status
$

8<----------------------------------------------------------------------

Changing the order of command line options doesn't seem to help.

8<----------------------------------------------------------------------

$ nm -D /usr/lib/x86_64-linux-gnu/libmnl.so|grep -Ew T
0000000000002f20 T mnl_attr_get_len
0000000000002fa0 T mnl_attr_get_payload
0000000000002f60 T mnl_attr_get_payload_len
0000000000003560 T mnl_attr_get_str
0000000000002ee0 T mnl_attr_get_type
00000000000034a0 T mnl_attr_get_u16
00000000000034e0 T mnl_attr_get_u32
0000000000003520 T mnl_attr_get_u64
0000000000003460 T mnl_attr_get_u8
0000000000003b80 T mnl_attr_nest_cancel
0000000000003b40 T mnl_attr_nest_end
0000000000003820 T mnl_attr_nest_start
0000000000003ae0 T mnl_attr_nest_start_check
0000000000003110 T mnl_attr_next
00000000000030c0 T mnl_attr_ok
0000000000003290 T mnl_attr_parse
0000000000003330 T mnl_attr_parse_nested
00000000000033e0 T mnl_attr_parse_payload
00000000000035a0 T mnl_attr_put
0000000000003870 T mnl_attr_put_check
0000000000003760 T mnl_attr_put_str
0000000000003a10 T mnl_attr_put_str_check
00000000000037c0 T mnl_attr_put_strz
0000000000003a70 T mnl_attr_put_strz_check
0000000000003670 T mnl_attr_put_u16
0000000000003920 T mnl_attr_put_u16_check
00000000000036c0 T mnl_attr_put_u32
0000000000003970 T mnl_attr_put_u32_check
0000000000003710 T mnl_attr_put_u64
00000000000039c0 T mnl_attr_put_u64_check
0000000000003620 T mnl_attr_put_u8
00000000000038d0 T mnl_attr_put_u8_check
0000000000003150 T mnl_attr_type_valid
00000000000031b0 T mnl_attr_validate
0000000000003220 T mnl_attr_validate2
0000000000002390 T mnl_cb_run
0000000000002200 T mnl_cb_run2
0000000000002e60 T mnl_nlmsg_batch_current
0000000000002e20 T mnl_nlmsg_batch_head
0000000000002ea0 T mnl_nlmsg_batch_is_empty
0000000000002d00 T mnl_nlmsg_batch_next
0000000000002d60 T mnl_nlmsg_batch_reset
0000000000002de0 T mnl_nlmsg_batch_size
0000000000002c60 T mnl_nlmsg_batch_start
0000000000002cc0 T mnl_nlmsg_batch_stop
0000000000002800 T mnl_nlmsg_fprintf
0000000000002600 T mnl_nlmsg_get_payload
0000000000002510 T mnl_nlmsg_get_payload_len
0000000000002640 T mnl_nlmsg_get_payload_offset
0000000000002720 T mnl_nlmsg_get_payload_tail
00000000000026d0 T mnl_nlmsg_next
0000000000002680 T mnl_nlmsg_ok
00000000000027b0 T mnl_nlmsg_portid_ok
00000000000025a0 T mnl_nlmsg_put_extra_header
0000000000002550 T mnl_nlmsg_put_header
0000000000002760 T mnl_nlmsg_seq_ok
00000000000024d0 T mnl_nlmsg_size
0000000000001e50 T mnl_socket_bind
0000000000002010 T mnl_socket_close
0000000000001dc0 T mnl_socket_fdopen
0000000000001cd0 T mnl_socket_get_fd
0000000000001d00 T mnl_socket_get_portid
00000000000020b0 T mnl_socket_getsockopt
0000000000001d40 T mnl_socket_open
0000000000001d80 T mnl_socket_open2
0000000000001f40 T mnl_socket_recvfrom
0000000000001ef0 T mnl_socket_sendto
0000000000002060 T mnl_socket_setsockopt
$

8<----------------------------------------------------------------------

Thanks for being interested. :)

-- 

73,
Ged.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-12  9:48           ` G.W. Haywood
@ 2025-03-13 10:04             ` Duncan Roe
  0 siblings, 0 replies; 10+ messages in thread
From: Duncan Roe @ 2025-03-13 10:04 UTC (permalink / raw)
  To: Netfilter Development

On Wed, Mar 12, 2025 at 09:48:00AM +0000, G.W. Haywood wrote:
> Hi Duncan,

> On Wed, 12 Mar 2025, Duncan Roe wrote:
> > On Tue, Mar 11, 2025 at 10:00:04AM +0000, G.W. Haywood wrote:
> > >
> > > Debian 11, gcc version 10.2.1-6 here.
> > >
> > > 8<----------------------------------------------------------------------
> > > $ gcc -g3 -gdwarf-4 -Wall -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
> > > /usr/bin/ld: /tmp/ccbLJv89.o: in function `nfq_send_verdict':
> > > /home/ged/nf-queue.c:30: undefined reference to `nfq_nlmsg_put'
> > > ...
> > > ...
> > > collect2: error: ld returned 1 exit status
> > > 8<----------------------------------------------------------------------
> > >
> > nf-queue.c has compiled fine.

> Quite so, but it hasn't linked and no executable has been produced... :/

> However, with the object and source file args at the beginning of the
> command line, there are no linker errors and the executable is produced.

Ok I can reproduce this on x86_64 in Debian 11.5. This is the first report in
almost 5 years, so I think the problem may be Debian-specific. But I will submit
a patch to change the argument order.

> # uname -a
> Linux laptop3 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 GNU/Linux

That's *old*. Linux 4.19 came out in October 2018

> # apt-get install libmnl-dev libmnl0 libnetfilter-queue-dev libnetfilter-queue1 libnftnl11 libnftnl-dev
> Reading package lists... Done
> Building dependency tree Reading state information... Done
> libmnl-dev is already the newest version (1.0.4-2).
> libmnl0 is already the newest version (1.0.4-2).
> libnetfilter-queue-dev is already the newest version (1.0.3-1).
> libnetfilter-queue1 is already the newest version (1.0.3-1).
> libnftnl-dev is already the newest version (1.1.2-2).
> libnftnl11 is already the newest version (1.1.2-2).
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> #

You fetched libnetfilter-queue-dev 1.0.3 but 1.0.5 is current since June 2020.

> $ gcc -g3 -gdwarf-4 -lmnl -lnetfilter_queue -o nf-queue nf-queue.c
> nf-queue.c: In function `nfq_send_verdict':
> nf-queue.c:30:8: warning: implicit declaration of function `nfq_nlmsg_put'; did you mean `nfq_nlmsg_parse'? [-Wimplicit-function-declaration]
>   nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, queue_num);
>         ^~~~~~~~~~~~~

Somehow the Debian folks updated the example to at least 1.0.4. nfq_nlmsg_put()
was in 1.0.4 but not 1.0.3.

Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-12  6:21         ` Duncan Roe
  2025-03-12  9:48           ` G.W. Haywood
@ 2025-03-28 13:55           ` G.W. Haywood
  2025-04-02  9:36             ` Duncan Roe
  1 sibling, 1 reply; 10+ messages in thread
From: G.W. Haywood @ 2025-03-28 13:55 UTC (permalink / raw)
  To: Netfilter Development

Hi there,

In the document at

https://netfilter.org/projects/libnetfilter_queue/doxygen/html/group__tcp.html#ga66fd94158867c63be8e4104d84050ac4

1. At the top of the page it mentions a diagram, but I don't see anything
in my browsers.  Have I missed something?

2. Each section covering a function mentions the function name three times.

Except in the section for the function

nfq_tcp_snprintf

which at the third attempt actually calls it

nfq_pkt_snprintf_tcp_hdr

and which had me confused for a while.

3. It also spells "human" as "humnan". :/

-- 

73,
Ged.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Documentation oddity.
  2025-03-28 13:55           ` G.W. Haywood
@ 2025-04-02  9:36             ` Duncan Roe
  0 siblings, 0 replies; 10+ messages in thread
From: Duncan Roe @ 2025-04-02  9:36 UTC (permalink / raw)
  To: G.W. Haywood; +Cc: Netfilter Development

Hi Ged,

On Fri, Mar 28, 2025 at 01:55:11PM +0000, G.W. Haywood wrote:
> Hi there,
>
> In the document at
>
> https://netfilter.org/projects/libnetfilter_queue/doxygen/html/group__tcp.html#ga66fd94158867c63be8e4104d84050ac4
>
> 1. At the top of the page it mentions a diagram, but I don't see anything
> in my browsers.  Have I missed something?

No, the diagram is not there because the system where the document was built did
not have the *graphviz* package installed. Graphviz supplies the `dot` utility
which doxygen uses to create diagrams.

In the absence of graphviz, the "Collaboration diagram..." line should not be
there. This was a build issue, now fixed but not yet released.

If you're keen to see the diagram, you could email the webmaster requesting a
rebuild with graphviz installed.
>
> 2. Each section covering a function mentions the function name three times.
>
> Except in the section for the function
>
> nfq_tcp_snprintf
>
> which at the third attempt actually calls it
>
> nfq_pkt_snprintf_tcp_hdr
>
> and which had me confused for a while.
>
> 3. It also spells "human" as "humnan". :/

2. & 3. are actually on the same line. It's been like that forever - I've
submitted a patch to fix (and nfq_udp_snprintf, same fixes).
>
Cheers ... Duncan.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-02  9:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 15:20 Documentation oddity G.W. Haywood
2024-12-19  9:22 ` Jozsef Kadlecsik
2025-03-10 18:00   ` G.W. Haywood
2025-03-11  0:00     ` Duncan Roe
2025-03-11 10:00       ` G.W. Haywood
2025-03-12  6:21         ` Duncan Roe
2025-03-12  9:48           ` G.W. Haywood
2025-03-13 10:04             ` Duncan Roe
2025-03-28 13:55           ` G.W. Haywood
2025-04-02  9:36             ` Duncan Roe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.