Created attachment 145286 [details] 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?
Just committed a fix to -CURRENT two days ago. Will MFC shortly.
Committed by cy 2014-08-05.