[Bug 192350] New: [ipf] ipnat via kld doesn't work with INET6 kernel option

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Aug 3 01:57:02 UTC 2014


            Bug ID: 192350
           Summary: [ipf] ipnat via kld doesn't work with INET6 kernel
           Product: Base System
           Version: 10.0-STABLE
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: newnix.ua at 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
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
ipnat -l
List of active MAP/Redirect filters:

List of active sessions:

Looks like Cy Schubert broke it with this fix

Here is what was changed in his fix that breaks ipnat when INET6 is enabled:
root at 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
<  * $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 $
< #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.

More information about the freebsd-bugs mailing list