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.