Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Aug 2014 01:57:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 192350] New: [ipf] ipnat via kld doesn't work with INET6 kernel option
Message-ID:  <bug-192350-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192350

            Bug ID: 192350
           Summary: [ipf] ipnat via kld doesn't work with INET6 kernel
                    option
           Product: Base System
           Version: 10.0-STABLE
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: newnix.ua@gmail.com

Created attachment 145286
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=145286&action=edit
ipv6 fix to ip_compat.h to work with ipf/ipnat

Just boot into this livecd
ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-STABLE-amd64-20140725-r269083-disc1.iso
or i386 one
Then type kldload ipfilter && ipnat -l
you'll get this:
70:ioctl(SIOCGNATS) object size mismatch for copying out ipfobj

To fix this in installed system:
cd /usr/src
patch -p0 < /root/ipnat-ip6fix-ip_compat.diff
cd sys/modules/ipfilter/ && make clean
cd ../../../sbin/ipf && make all install clean
Then:
ipnat -l
List of active MAP/Redirect filters:

List of active sessions:


Looks like Cy Schubert broke it with this fix
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190964

Here is what was changed in his fix that breaks ipnat when INET6 is enabled:
root@amd64older:/usr/src/sys/contrib/ipfilter # diff -r
/usr/src/sys/contrib/ipfilter /root/src/sys/contrib/ipfilter
diff -r /usr/src/sys/contrib/ipfilter/netinet/ip_compat.h
/root/src/sys/contrib/ipfilter/netinet/ip_compat.h
7c7
<  * $FreeBSD: stable/10/sys/contrib/ipfilter/netinet/ip_compat.h 255754
2013-09-21 03:57:56Z cy $
---
>  * $FreeBSD: stable/10/sys/contrib/ipfilter/netinet/ip_compat.h 268937 2014-07-21 06:45:19Z cy $
36,39d35
< #if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000) && \
<     !defined(_KERNEL) && !defined(USE_INET6) && !defined(NOINET6)
< # define      USE_INET6
< #endif

Sure this def utilizes an old way to pass kernel build options so NOINET6 does
not work.
But deleting this ifdef completely forces to compile userland ipf without
-DUSE_INET6. So we should use MK_INET_SUPPORT in some way and it was made in
this same file (ip_compat.h):
# define HAS_SYS_MD5_H  1
# if defined(_KERNEL)
#   include "opt_bpf.h"
#   include "opt_inet6.h"
#  if defined(INET6) && !defined(USE_INET6)
#   define USE_INET6
#  endif
# endif

As you can see for some reason it was made not to work with userland.
Is there a strong reason for this? Is it safe to enable it here or this must be
done in some other way?

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-192350-8>