miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

support command iptables without requirement netfilter code

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Feature Request
View previous topic :: View next topic  
Author Message
zamir



Joined: 01 Mar 2010
Posts: 16

PostPosted: Mon Mar 01, 2010 8:55 am    Post subject: support command iptables without requirement netfilter code Reply with quote

please, add support native command "iptables" without requirement netfilter code
similar in project:
- natpmp
- linux-igd
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Mar 03, 2010 11:11 am    Post subject: Reply with quote

well, you can add it yourself ! (or use linux-igd)
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
zamir



Joined: 01 Mar 2010
Posts: 16

PostPosted: Thu Mar 04, 2010 7:07 am    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Mar 04, 2010 12:25 pm    Post subject: Reply with quote

Code:
/usr/lib64/libiptc.a
/usr/lib64/libiptc.la
/usr/lib64/libiptc.so

These are the required libraries.
Check the line
Code:
LIBS=-liptc
in Makefile.linux
Build with make -f Makefile.linux
What are the error messages ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
zamir



Joined: 01 Mar 2010
Posts: 16

PostPosted: Fri Mar 05, 2010 6:39 am    Post subject: Reply with quote

[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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Fri Mar 05, 2010 10:36 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
zamir



Joined: 01 Mar 2010
Posts: 16

PostPosted: Sat Mar 06, 2010 5:24 am    Post subject: Reply with quote

package
http://search.cpan.org/CPAN/authors/id/H/HA/HAWK/IPTables-libiptc-0.18.tar.gz
include all needs iptables library, iptables.h and other...
Can so should be?
Nevertheless i'm report bug to mandriva linux developers:
https://qa.mandriva.com/show_bug.cgi?id=58007
Back to top
View user's profile Send private message
eugeni_dodonov



Joined: 08 Mar 2010
Posts: 1

PostPosted: Mon Mar 08, 2010 11:33 am    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Mar 08, 2010 1:26 pm    Post subject: Reply with quote

thanks a lot for the patch !!!
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Mar 08, 2010 5:19 pm    Post subject: Reply with quote

You can test miniupnpd-1.4.20100308.tar.gz.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
zamir



Joined: 01 Mar 2010
Posts: 16

PostPosted: Tue Mar 09, 2010 6:57 am    Post subject: Reply with quote

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
View user's profile Send private message
user00265



Joined: 28 Jan 2011
Posts: 2

PostPosted: Fri Jan 28, 2011 6:40 am    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Fri Jan 28, 2011 9:04 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
user00265



Joined: 28 Jan 2011
Posts: 2

PostPosted: Sat Jan 29, 2011 7:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Feature Request All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.