View previous topic :: View next topic |
Author |
Message |
zamir
Joined: 01 Mar 2010 Posts: 16
|
Posted: Mon Mar 01, 2010 8:55 am Post subject: support command iptables without requirement netfilter code |
|
|
please, add support native command "iptables" without requirement netfilter code
similar in project:
- natpmp
- linux-igd |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
Posted: Wed Mar 03, 2010 11:11 am Post subject: |
|
|
well, you can add it yourself ! (or use linux-igd) _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
zamir
Joined: 01 Mar 2010 Posts: 16
|
Posted: Thu Mar 04, 2010 7:07 am Post subject: |
|
|
Unfortunately I can not programmable in the language of "c"
I can write program in perl and php: (
I can not build rpm for miniupnp because miniupnp requires iptables source code
rpm iptables-devel not contains requires library for compilation miniupnp
Code: | # rpm -ql lib64iptables-devel-1.4.3.2-5mnb2
/usr/include/libipq
/usr/include/libipq.h
/usr/include/libipq/libipq.h
/usr/include/libiptc
/usr/include/libiptc/ipt_kernel_headers.h
/usr/include/libiptc/libip6tc.h
/usr/include/libiptc/libiptc.h
/usr/include/libiptc/libxtc.h
/usr/include/libipulog
/usr/include/libipulog/libipulog.h
/usr/include/xtables.h
/usr/lib64/libip6tables.a
/usr/lib64/libipq.a
/usr/lib64/libiptables.a
/usr/lib64/libiptc.a
/usr/lib64/libiptc.la
/usr/lib64/libiptc.so
/usr/lib64/libxtables.la
/usr/lib64/libxtables.so
/usr/lib64/pkgconfig/libiptc.pc
/usr/lib64/pkgconfig/xtables.pc
/usr/share/man/man3/ipq_create_handle.3.lzma
/usr/share/man/man3/ipq_destroy_handle.3.lzma
/usr/share/man/man3/ipq_errstr.3.lzma
/usr/share/man/man3/ipq_get_msgerr.3.lzma
/usr/share/man/man3/ipq_get_packet.3.lzma
/usr/share/man/man3/ipq_message_type.3.lzma
/usr/share/man/man3/ipq_perror.3.lzma
/usr/share/man/man3/ipq_read.3.lzma
/usr/share/man/man3/ipq_set_mode.3.lzma
/usr/share/man/man3/ipq_set_verdict.3.lzma
/usr/share/man/man3/libipq.3.lzma
|
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
Posted: Thu Mar 04, 2010 12:25 pm Post subject: |
|
|
Code: | /usr/lib64/libiptc.a
/usr/lib64/libiptc.la
/usr/lib64/libiptc.so |
These are the required libraries.
Check the line in Makefile.linux
Build with make -f Makefile.linux
What are the error messages ? _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
zamir
Joined: 01 Mar 2010 Posts: 16
|
Posted: Fri Mar 05, 2010 6:39 am Post subject: |
|
|
[root@Z1 miniupnpd-1.4.20091222]# cat ./Makefile.linux |grep LIBS
Quote: | LIBS = -liptc
#LIBS = $(IPTABLESPATH)/libiptc/.libs/libip4tc.o
#LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS) |
[root@Z1 miniupnpd-1.4.20091222]# make -f Makefile.linux
Code: | gcc -Wall -Os -D_GNU_SOURCE -c -o netfilter/iptcrdr.o netfilter/iptcrdr.c
netfilter/iptcrdr.c:17:22: error: iptables.h: No such file or directory
netfilter/iptcrdr.c:32:36: error: linux/netfilter/nf_nat.h: No such file or directory
netfilter/iptcrdr.c: In function 'get_redirect_rule':
netfilter/iptcrdr.c:161: error: 'iptc_handle_t' undeclared (first use in this function)
netfilter/iptcrdr.c:161: error: (Each undeclared identifier is reported only once
netfilter/iptcrdr.c:161: error: for each function it appears in.)
netfilter/iptcrdr.c:161: error: expected ';' before 'h'
netfilter/iptcrdr.c:167: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c:211: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:212: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c: In function 'get_redirect_rule_by_index':
netfilter/iptcrdr.c:245: error: 'iptc_handle_t' undeclared (first use in this function)
netfilter/iptcrdr.c:245: error: expected ';' before 'h'
netfilter/iptcrdr.c:251: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c:293: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:294: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c: At top level:
netfilter/iptcrdr.c:320: error: expected declaration specifiers or '...' before 'iptc_handle_t'
netfilter/iptcrdr.c: In function 'delete_rule_and_commit':
netfilter/iptcrdr.c:328: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c: In function 'delete_redirect_and_filter_rules':
netfilter/iptcrdr.c:362: error: 'iptc_handle_t' undeclared (first use in this function)
netfilter/iptcrdr.c:362: error: expected ';' before 'h'
netfilter/iptcrdr.c:366: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c:426: error: too many arguments to function 'delete_rule_and_commit'
netfilter/iptcrdr.c:430: error: too many arguments to function 'delete_rule_and_commit'
netfilter/iptcrdr.c: In function 'get_dnat_target':
netfilter/iptcrdr.c:487: error: invalid application of 'sizeof' to incomplete type 'struct ip_nat_multi_range'
netfilter/iptcrdr.c:493: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:494: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:495: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:495: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:496: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:496: error: 'IP_NAT_RANGE_MAP_IPS' undeclared (first use in this function)
netfilter/iptcrdr.c:497: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:497: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:498: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:498: error: 'IP_NAT_RANGE_PROTO_SPECIFIED' undeclared (first use in this function)
netfilter/iptcrdr.c: In function 'iptc_init_verify_and_append':
netfilter/iptcrdr.c:508: error: 'iptc_handle_t' undeclared (first use in this function)
netfilter/iptcrdr.c:508: error: expected ';' before 'h'
netfilter/iptcrdr.c:509: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c: In function 'list_redirect_rule':
netfilter/iptcrdr.c:728: error: 'iptc_handle_t' undeclared (first use in this function)
netfilter/iptcrdr.c:728: error: expected ';' before 'h'
netfilter/iptcrdr.c:734: error: 'h' undeclared (first use in this function)
netfilter/iptcrdr.c:788: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:790: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:791: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:792: error: dereferencing pointer to incomplete type
netfilter/iptcrdr.c:793: error: dereferencing pointer to incomplete type
make: *** [netfilter/iptcrdr.o] Error 1 |
Quote: | netfilter/iptcrdr.c:17:22: error: iptables.h: No such file or directory
netfilter/iptcrdr.c:32:36: error: linux/netfilter/nf_nat.h: No such file or directory |
this lib exist in source iptables only
i'am successfully compilation only with source code iptables and make command:
IPTABLESPATH=/path/to/iptables-1.4.3.2 make -f Makefile.linux
line 57: LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
not correct for me
changed in: LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
iptables-1.4.3.2 |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
Posted: Fri Mar 05, 2010 10:36 am Post subject: |
|
|
humm I see there is some missing .h files in the lib64iptables-devel package. You should report that to the package maintainer. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
zamir
Joined: 01 Mar 2010 Posts: 16
|
|
Back to top |
|
|
eugeni_dodonov
Joined: 08 Mar 2010 Posts: 1
|
Posted: Mon Mar 08, 2010 11:33 am Post subject: |
|
|
Hi,
being the Mandriva maintainer of iptables package, I checked this bug. Indeed, our rpm -devel packages were missing some of the includes (such as iptables.h and net/netfilter/nf_nat.h). I checked with other distros, and added then in the same way as Fedora/Redhat.
However, there are two issues in Makefile.linux that required tweaking in order to compile the binary: if IPTABLESPATH is not defined, the Makefile.linux is unable to properly discover the version of iptables and define the IPTABLES_143 variable, and I had to add the full path to the libiptc.a file. I used a quick trick to make it work, by checking the presence of /usr/include/iptables/private.h file and adjusting the variables accordingly, but this is not the best way to do it:
diff -p -up miniupnpd-1.4/Makefile.linux.mdv miniupnpd-1.4/Makefile.linux
--- miniupnpd-1.4/Makefile.linux.mdv 2010-03-08 07:44:59.000000000 -0300
+++ miniupnpd-1.4/Makefile.linux 2010-03-08 08:03:10.000000000 -0300
@@ -60,6 +60,13 @@ LIBS = $(IPTABLESPATH)/libiptc/libiptc.a
endif
endif
+# check for system-wide iptables files
+TEST := $(shell grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
+ifeq ($(TEST), 1)
+CFLAGS := $(CFLAGS) -DIPTABLES_143
+LIBS = /usr/lib/libiptc.a
+endif
+
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
As this check could vary from distro to distro, what would you suggest to make it work on a cross-distro environment? |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
|
Back to top |
|
|
zamir
Joined: 01 Mar 2010 Posts: 16
|
Posted: Tue Mar 09, 2010 6:57 am Post subject: |
|
|
LIBS = /usr/lib/libiptc.a - not correct for x86_64 (/usr/lib64/libiptc.a)
LIBS = -liptc - work for me.
# diff -u ./Makefile.linux ./Makefile.linux.mdv2009.1
Code: | --- ./Makefile.linux 2010-03-08 20:13:54.000000000 +0300
+++ ./Makefile.linux.mdv2009.1 2010-03-09 09:44:13.000000000 +0300
@@ -66,7 +66,7 @@
TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define
IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
ifeq ($(TEST), 1)
CFLAGS := $(CFLAGS) -DIPTABLES_143
-LIBS = /usr/lib/libiptc.a
+LIBS = -liptc
endif
endif |
P.S. new iptables-devel included need files:
Quote: | /usr/include/ip6tables.h
/usr/include/iptables.h
/usr/include/iptables/internal.h
/usr/include/libipq
/usr/include/libipq.h
/usr/include/libipq/libipq.h
/usr/include/libiptc
/usr/include/libiptc/ipt_kernel_headers.h
/usr/include/libiptc/libip6tc.h
/usr/include/libiptc/libiptc.h
/usr/include/libiptc/libxtc.h
/usr/include/libipulog
/usr/include/libipulog/libipulog.h
/usr/include/net/netfilter/nf_conntrack_tuple.h
/usr/include/net/netfilter/nf_nat.h
/usr/include/xtables.h
/usr/lib64/libip6tables.a
/usr/lib64/libipq.a
/usr/lib64/libiptables.a
/usr/lib64/libiptc.a
/usr/lib64/libiptc.la
/usr/lib64/libiptc.so
/usr/lib64/libxtables.la
/usr/lib64/libxtables.so
/usr/lib64/pkgconfig/libiptc.pc
/usr/lib64/pkgconfig/xtables.pc
/usr/share/man/man3/ipq_create_handle.3.lzma
/usr/share/man/man3/ipq_destroy_handle.3.lzma
/usr/share/man/man3/ipq_errstr.3.lzma
/usr/share/man/man3/ipq_get_msgerr.3.lzma
/usr/share/man/man3/ipq_get_packet.3.lzma
/usr/share/man/man3/ipq_message_type.3.lzma
/usr/share/man/man3/ipq_perror.3.lzma
/usr/share/man/man3/ipq_read.3.lzma
/usr/share/man/man3/ipq_set_mode.3.lzma
/usr/share/man/man3/ipq_set_verdict.3.lzma
/usr/share/man/man3/libipq.3.lzma |
Problem fixed.
Thanks for all ! |
|
Back to top |
|
|
user00265
Joined: 28 Jan 2011 Posts: 2
|
Posted: Fri Jan 28, 2011 6:40 am Post subject: |
|
|
What header files does it require in itself? I used the same versions miniupnp tested, but I did not get a successful compile.
Command:
Code: | IPTABLES=../iptables-1.4.10 make -f Makefile.linux |
Result:
Code: | gcc -Wall -Os -D_GNU_SOURCE -I/home/user00265/miniupnpd/src/iptables-1.4.10/include/ -DIPTABLES_143 -c -o linux/getifstats.o linux/getifstats.c
gcc -Wall -Os -D_GNU_SOURCE -I/home/user00265/miniupnpd/src/iptables-1.4.10/include/ -DIPTABLES_143 -c -o netfilter/iptcrdr.o netfilter/iptcrdr.c
gcc -L/home/user00265/miniupnpd/src/iptables-1.4.10/libiptc/ miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o upnpreplyparse.o minixml.o upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o options.o upnppermissions.o minissdp.o natpmp.o upnpevents.o linux/getifstats.o netfilter/iptcrdr.o /home/user00265/miniupnpd/src/iptables-1.4.10/libiptc/.libs/libiptc.a -o miniupnpd
netfilter/iptcrdr.o: In function `iptc_init_verify_and_append':
iptcrdr.c:(.text+0x18a): undefined reference to `iptc_init'
iptcrdr.c:(.text+0x1a3): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x1c1): undefined reference to `iptc_is_chain'
iptcrdr.c:(.text+0x1d7): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x1f0): undefined reference to `iptc_free'
iptcrdr.c:(.text+0x203): undefined reference to `iptc_append_entry'
iptcrdr.c:(.text+0x219): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x22d): undefined reference to `iptc_commit'
iptcrdr.c:(.text+0x243): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x257): undefined reference to `iptc_free'
netfilter/iptcrdr.o: In function `delete_rule_and_commit':
iptcrdr.c:(.text+0x27a): undefined reference to `iptc_delete_num_entry'
iptcrdr.c:(.text+0x290): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x2a4): undefined reference to `iptc_commit'
iptcrdr.c:(.text+0x2ba): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x2db): undefined reference to `iptc_free'
netfilter/iptcrdr.o: In function `get_redirect_rule':
iptcrdr.c:(.text+0x33a): undefined reference to `iptc_init'
iptcrdr.c:(.text+0x355): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x37b): undefined reference to `iptc_is_chain'
iptcrdr.c:(.text+0x3ab): undefined reference to `iptc_first_rule'
iptcrdr.c:(.text+0x452): undefined reference to `iptc_next_rule'
iptcrdr.c:(.text+0x46b): undefined reference to `iptc_free'
netfilter/iptcrdr.o: In function `get_redirect_rule_by_index':
iptcrdr.c:(.text+0x48b): undefined reference to `iptc_init'
iptcrdr.c:(.text+0x4a6): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x4cc): undefined reference to `iptc_is_chain'
iptcrdr.c:(.text+0x4fe): undefined reference to `iptc_first_rule'
iptcrdr.c:(.text+0x5c2): undefined reference to `iptc_next_rule'
iptcrdr.c:(.text+0x5db): undefined reference to `iptc_free'
netfilter/iptcrdr.o: In function `delete_redirect_and_filter_rules':
iptcrdr.c:(.text+0x602): undefined reference to `iptc_init'
iptcrdr.c:(.text+0x61d): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0x643): undefined reference to `iptc_is_chain'
iptcrdr.c:(.text+0x672): undefined reference to `iptc_first_rule'
iptcrdr.c:(.text+0x6c1): undefined reference to `iptc_next_rule'
iptcrdr.c:(.text+0x6dc): undefined reference to `iptc_free'
iptcrdr.c:(.text+0x6fd): undefined reference to `iptc_init'
iptcrdr.c:(.text+0x72f): undefined reference to `iptc_init'
netfilter/iptcrdr.o: In function `list_redirect_rule':
iptcrdr.c:(.text+0xaa9): undefined reference to `iptc_init'
iptcrdr.c:(.text+0xac1): undefined reference to `iptc_strerror'
iptcrdr.c:(.text+0xade): undefined reference to `iptc_is_chain'
iptcrdr.c:(.text+0xaff): undefined reference to `iptc_free'
iptcrdr.c:(.text+0xb18): undefined reference to `iptc_first_rule'
iptcrdr.c:(.text+0xb26): undefined reference to `iptc_get_target'
iptcrdr.c:(.text+0xd22): undefined reference to `iptc_next_rule'
iptcrdr.c:(.text+0xd38): undefined reference to `iptc_free'
collect2: ld returned 1 exit status
make: *** [miniupnpd] Error 1 |
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1592
|
Posted: Fri Jan 28, 2011 9:04 am Post subject: |
|
|
user00265 wrote: | What header files does it require in itself? I used the same versions miniupnp tested, but I did not get a successful compile.
|
the "undefined reference" errors are not related to the header files but show there is a problem with the libiptc.a library.
You should check if you need to use libip4tc.a instead. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
user00265
Joined: 28 Jan 2011 Posts: 2
|
Posted: Sat Jan 29, 2011 7:53 pm Post subject: |
|
|
I changed the LIBS variable inside Makefile.linux and that didn't particularly work, so I did this and it worked:
Code: | sed -i 's@libiptc.a@libip4tc.a@g' Makefile.linux |
|
|
Back to top |
|
|
|