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 

FreeBSD 9.2 + IPFW

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation
View previous topic :: View next topic  
Author Message
ArnoB



Joined: 06 Apr 2014
Posts: 5

PostPosted: Sun Apr 06, 2014 5:24 pm    Post subject: FreeBSD 9.2 + IPFW Reply with quote

Hi,

I'm trying to compile/install miniupnpd from ports on my FreeBSD 9.2Rp1 server with IPFW.

Code:
# cd /usr/ports/net/miniupnpd
# make install clean


gives this error:
Code:
...
pf/obsdrdr.c: In function 'add_redirect_rule2':
pf/obsdrdr.c:198: error: 'anchor_name' undeclared (first use in this function)
pf/obsdrdr.c:198: error: (Each undeclared identifier is reported only once
pf/obsdrdr.c:198: error: for each function it appears in.)
pf/obsdrdr.c:254: error: 'tag' undeclared (first use in this function)
pf/obsdrdr.c: In function 'get_redirect_rule':
pf/obsdrdr.c:475: error: 'anchor_name' undeclared (first use in this function)
pf/obsdrdr.c: In function 'delete_redirect_rule':
pf/obsdrdr.c:576: error: 'anchor_name' undeclared (first use in this function)
pf/obsdrdr.c: In function 'get_redirect_rule_by_index':
pf/obsdrdr.c:694: error: 'anchor_name' undeclared (first use in this function)
pf/obsdrdr.c: In function 'get_portmappings_in_range':
pf/obsdrdr.c:806: error: 'anchor_name' undeclared (first use in this function)
pf/obsdrdr.c:837: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'unsigned int'
*** [pf/obsdrdr.o] Error code 1

Stop in /usr/ports/net/miniupnpd/work/miniupnpd-1.8.
*** [do-build] Error code 1

Stop in /usr/ports/net/miniupnpd.
*** [install] Error code 1

Stop in /usr/ports/net/miniupnpd.


I was able to get rid of these errors by adding the following code to pf/obsdrdr.c:

Code:
62a63,68
> /* FreeBSD 9.2Rp1 */
> const char * tag = 1;
> static const char anchor_name[] = "miniupnpd";


I haven't found out what the 'tag' variable should be yet. It's a bit beyond my coding knowledge. This made it compile and install. I also tried with tag=0.

I added these values to /etc/rc.conf:
Code:
ipfilter_enable="NO"
pf_enable="NO"
miniupnpd_enable="YES"


the output of genconf.sh:
Code:
Using ifpw
Configuring compilation for [FreeBSD] [9.2-RELEASE-p1] with [ipfw] firewall software.
Please edit config.h for more compilation options.


Next I changed /usr/local/etc/miniupnpd.conf.

Then when I start miniupnpd I still get this in my syslog:
Code:
... miniupnpd[88827]: open("/dev/pf"): No such file or directory
... miniupnpd[88827]: Failed to init redirection engine. EXITING


So it looks like it's still trying to use PF in stead of IPFW...

Can anyone help me out with this please?

thanks in advance

Arno
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Apr 07, 2014 10:30 am    Post subject: Reply with quote

there is be a problem in makefile so that it tries to compile pf code instead of ipfw one...

Try this :
Code:
--- Makefile    31 Mar 2014 12:21:23 -0000      1.79
+++ Makefile    7 Apr 2014 10:29:43 -0000
@@ -45,7 +45,8 @@ FWNAME = ipf
 .if $(OSNAME) == "FreeBSD"
 FWNAME != . /etc/rc.subr; . /etc/rc.conf; \
           if checkyesno ipfilter_enable; then \
-          echo "ipf"; else echo "pf"; fi
+          echo "ipf"; elif checkyesno pf_enable; then \
+          echo "pf"; else echo "ipfw" ; fi
 .endif
 
 .if $(OSNAME) == "NetBSD"

_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
ArnoB



Joined: 06 Apr 2014
Posts: 5

PostPosted: Sun Apr 13, 2014 9:44 am    Post subject: Reply with quote

Hi, thanks for your reply.
unfortunately it doesn't change any of the problems.

I still have to manually add the 'tag' and 'anchor_name' variables.
Even after applying the patch from above it still doesn't pick up ipfw.

Quote:
miniupnpd[89778]: open("/dev/pf"): No such file or directory
miniupnpd[89778]: Failed to init redirection engine. EXITING
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Apr 14, 2014 7:25 am    Post subject: Reply with quote

have you forced FWNAME=ipfw in Makefile ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
ArnoB



Joined: 06 Apr 2014
Posts: 5

PostPosted: Mon Apr 14, 2014 1:56 pm    Post subject: Reply with quote

miniupnp wrote:
have you forced FWNAME=ipfw in Makefile ?


that works!
at least... it chooses IPFW now.

then the next problem arises:

Code:

===>  Building for miniupnpd-1.8.20140310,1
cc -O2 -pipe -fno-strict-aliasing  -ansi -Wall -W -Wstrict-prototypes -fno-common -c -o ipfw/ipfwrdr.o ipfw/ipfwrdr.c
ipfw/ipfwrdr.c: In function 'add_redirect_rule2':
ipfw/ipfwrdr.c:175: error: 'struct ip_fw' has no member named 'version'
ipfw/ipfwrdr.c:175: error: 'IP_FW_CURRENT_API_VERSION' undeclared (first use in this function)
ipfw/ipfwrdr.c:175: error: (Each undeclared identifier is reported only once
ipfw/ipfwrdr.c:175: error: for each function it appears in.)
ipfw/ipfwrdr.c:180: error: 'struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:181: error: 'struct ip_fw' has no member named 'fw_flg'
ipfw/ipfwrdr.c:181: error: 'IP_FW_F_IIFACE' undeclared (first use in this function)
ipfw/ipfwrdr.c:182: error: 'struct ip_fw' has no member named 'fw_flg'
ipfw/ipfwrdr.c:182: error: 'IP_FW_F_IIFNAME' undeclared (first use in this function)
ipfw/ipfwrdr.c:183: error: 'struct ip_fw' has no member named 'fw_flg'
ipfw/ipfwrdr.c:183: error: 'IP_FW_F_IN' undeclared (first use in this function)
ipfw/ipfwrdr.c:183: error: 'IP_FW_F_OUT' undeclared (first use in this function)
ipfw/ipfwrdr.c:184: error: 'struct ip_fw' has no member named 'fw_flg'
ipfw/ipfwrdr.c:184: error: 'IP_FW_F_FWD' undeclared (first use in this function)
ipfw/ipfwrdr.c:187: error: 'struct ip_fw' has no member named 'fw_in_if'
ipfw/ipfwrdr.c:188: error: 'struct ip_fw' has no member named 'fw_in_if'
ipfw/ipfwrdr.c:191: error: 'struct ip_fw' has no member named 'fw_out_if'
ipfw/ipfwrdr.c:195: error: 'struct ip_fw' has no member named 'fw_dst'
ipfw/ipfwrdr.c:195: error: 'struct ip_fw' has no member named 'fw_out_if'
ipfw/ipfwrdr.c:196: error: 'struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:196: error: 'struct ip_fw' has no member named 'fw_out_if'
ipfw/ipfwrdr.c:197: error: 'struct ip_fw' has no member named 'fw_dmsk'
ipfw/ipfwrdr.c:198: warning: implicit declaration of function 'IP_FW_SETNDSTP'
ipfw/ipfwrdr.c:199: error: 'struct ip_fw' has no member named 'fw_uar'
ipfw/ipfwrdr.c:200: error: 'struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:202: error: 'struct ip_fw' has no member named 'fw_src'
ipfw/ipfwrdr.c:203: error: 'struct ip_fw' has no member named 'fw_smsk'
ipfw/ipfwrdr.c: In function 'get_redirect_rule':
ipfw/ipfwrdr.c:248: error: 'const struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:248: error: 'const struct ip_fw' has no member named 'fw_uar'
ipfw/ipfwrdr.c:250: error: 'const struct ip_fw' has no member named 'fw_pcnt'
ipfw/ipfwrdr.c:252: error: 'const struct ip_fw' has no member named 'fw_bcnt'
ipfw/ipfwrdr.c:254: error: 'const struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:258: error: 'const struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:264: error: 'const struct ip_fw' has no member named 'fw_src'
ipfw/ipfwrdr.c:266: error: 'const struct ip_fw' has no member named 'fw_src'
ipfw/ipfwrdr.c: In function 'delete_redirect_rule':
ipfw/ipfwrdr.c:305: error: 'const struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:305: error: 'const struct ip_fw' has no member named 'fw_uar'
ipfw/ipfwrdr.c: In function 'add_filter_rule2':
ipfw/ipfwrdr.c:322: warning: unused parameter 'ifname'
ipfw/ipfwrdr.c:323: warning: unused parameter 'rhost'
ipfw/ipfwrdr.c:324: warning: unused parameter 'iaddr'
ipfw/ipfwrdr.c:325: warning: unused parameter 'eport'
ipfw/ipfwrdr.c:326: warning: unused parameter 'iport'
ipfw/ipfwrdr.c:327: warning: unused parameter 'proto'
ipfw/ipfwrdr.c:328: warning: unused parameter 'desc'
ipfw/ipfwrdr.c: In function 'delete_filter_rule':
ipfw/ipfwrdr.c:334: warning: unused parameter 'ifname'
ipfw/ipfwrdr.c:335: warning: unused parameter 'eport'
ipfw/ipfwrdr.c:336: warning: unused parameter 'proto'
ipfw/ipfwrdr.c: In function 'get_redirect_rule_by_index':
ipfw/ipfwrdr.c:370: error: 'const struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:373: error: 'const struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:375: error: 'const struct ip_fw' has no member named 'fw_uar'
ipfw/ipfwrdr.c:377: error: 'const struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:379: error: 'const struct ip_fw' has no member named 'fw_in_if'
ipfw/ipfwrdr.c:381: error: 'const struct ip_fw' has no member named 'fw_pcnt'
ipfw/ipfwrdr.c:383: error: 'const struct ip_fw' has no member named 'fw_bcnt'
ipfw/ipfwrdr.c:385: error: 'const struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:389: error: 'const struct ip_fw' has no member named 'fw_fwd_ip'
ipfw/ipfwrdr.c:395: error: 'const struct ip_fw' has no member named 'fw_src'
ipfw/ipfwrdr.c:397: error: 'const struct ip_fw' has no member named 'fw_src'
ipfw/ipfwrdr.c: In function 'get_portmappings_in_range':
ipfw/ipfwrdr.c:445: error: 'const struct ip_fw' has no member named 'fw_uar'
ipfw/ipfwrdr.c:446: error: 'const struct ip_fw' has no member named 'fw_prot'
ipfw/ipfwrdr.c:453: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'unsigned int'
*** [ipfw/ipfwrdr.o] Error code 1

Stop in /usr/ports/net/miniupnpd/work/miniupnpd-1.8.20140310.
*** [do-build] Error code 1

Stop in /usr/ports/net/miniupnpd.
*** [build] Error code 1

Stop in /usr/ports/net/miniupnpd.


I dug a bit into this and found huge differences between ipfw.c on FreeBSD and the one on OSX.
Does this show that miniupnpd is written for OSX and without a lot of rewrites will not work on FreeBSD?

thanks again!

greets
Arno
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Apr 14, 2014 3:09 pm    Post subject: Reply with quote

well the ipfw code is old and not maintained. In fact all FreeBSD users except you have switched to pf Wink
Indeed it was a Mac OS X dev which made the ipfw but now OS X has switched to pf too...
it may need a lot of work to get it working on FreeBSD.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
jweyrich



Joined: 18 Jul 2009
Posts: 6
Location: Brazil

PostPosted: Mon Apr 14, 2014 10:17 pm    Post subject: Reply with quote

It looks like your system is missing the ipfw header files. Do you have them in /usr/include?
Back to top
View user's profile Send private message
darkomen



Joined: 15 Apr 2014
Posts: 4

PostPosted: Tue Apr 15, 2014 2:21 pm    Post subject: Reply with quote

i have problems this ipf
Back to top
View user's profile Send private message
ArnoB



Joined: 06 Apr 2014
Posts: 5

PostPosted: Tue Apr 15, 2014 7:13 pm    Post subject: Reply with quote

miniupnp wrote:
well the ipfw code is old and not maintained. In fact all FreeBSD users except you have switched to pf Wink
Indeed it was a Mac OS X dev which made the ipfw but now OS X has switched to pf too...
it may need a lot of work to get it working on FreeBSD.


I know... I know... Wink

well, thanks for clearing this out.. I'll have to switch to pf then.
I was planning on doing it anyway with the upgrade to FBSD 10.
I guess I have to speed that process up then Wink

thanks mini!
Back to top
View user's profile Send private message
ArnoB



Joined: 06 Apr 2014
Posts: 5

PostPosted: Tue Apr 15, 2014 7:14 pm    Post subject: Reply with quote

jweyrich wrote:
It looks like your system is missing the ipfw header files. Do you have them in /usr/include?


as far as I could see it's because of the huge differences between ipfw.h on OSX and ipfw.h on FreeBSD 9 and 10.
obviously too big to fix and probably not worth the effort.

I've got this:
# ll /usr/include/netinet/ip_fw.h
-r--r--r-- 1 root wheel 19849 Oct 28 19:05 /usr/include/netinet/ip_fw.h

cheers
arno
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 Compilation/Installation 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.