Skip to contentSkip to conversation

problem with trying the example

DISCUSSION Jee J.Z. 2 participants 3 messages Dec 1, 2003

lore
Share & tools
lore

Jee J.Z.

author
#0 lore raw

Hi all,

I am new to netfilter and even linux. I just wish to try the example code in the man page of libipq (I saved it as test.c and have compiled it to test.o). But when I make it: #cc test.o -o test, the following errors showed up:

[root@kite1 netfilter]# cc test.o -o test
test.o(.text+0xf): In function `die':
: undefined reference to `ipq_perror'
test.o(.text+0x1d): In function `die':
: undefined reference to `ipq_destroy_handle'
test.o(.text+0x49): In function `main':
: undefined reference to `ipq_create_handle'
test.o(.text+0x81): In function `main':
: undefined reference to `ipq_set_mode'
test.o(.text+0xb8): In function `main':
: undefined reference to `ipq_read'
test.o(.text+0xe4): In function `main':
: undefined reference to `ipq_message_type'
test.o(.text+0x116): In function `main':
: undefined reference to `ipq_get_msgerr'
test.o(.text+0x141): In function `main':
: undefined reference to `ipq_get_packet'
test.o(.text+0x18c): In function `main':
: undefined reference to `ipq_set_verdict'
test.o(.text+0x1ce): In function `main':
: undefined reference to `ipq_set_verdict'
collect2: ld returned 1 exit status

I have installed iptables-1.2.9 following the instructions. Does it mean I have to link 'test.o' with another file (???.o or ???.so)? Thank you in advance!

Jee

#1 lore raw
Quoted 5 lines · Jee J.Z.

Hi all,

I am new to netfilter and even linux. I just wish to try the example code in the man page of libipq (I saved it as test.c and have compiled it to test.o). But when I make it: #cc test.o -o test, the following errors showed up:

[root@kite1 netfilter]# cc test.o -o test

you need to link with the libipq library :

cc test.o -o test -lipq

Signature · 2 lines
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)
author
#2 lore raw

Hi Eric,

Thank you very much. I went through the link process, but when I execute the program:

./test

The following occurs:

passer: Failed to send netlink message: Connection refused

Could you point out for me how I can solve it again? Cheers!

Regards,
Ji

Quoted 5 lines · Jee J.Z.

Hi all,

I am new to netfilter and even linux. I just wish to try the example code in the man page of libipq (I saved it as test.c and have compiled it to test.o). But when I make it: #cc test.o -o test, the following errors showed up:

[root@kite1 netfilter]# cc test.o -o test

you need to link with the libipq library :

cc test.o -o test -lipq

Signature · 2 lines
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)