From e6f471a3b671a1c11c9375099b13574cfc1dc0af Mon Sep 17 00:00:00 2001 From: bbruns Date: Sat, 12 Apr 2014 20:36:55 +0000 Subject: [PATCH] Check for NAT being enabled first before adding NAT table --- lib/iptables.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/iptables.inc b/lib/iptables.inc index d9d2c41..ef9134e 100644 --- a/lib/iptables.inc +++ b/lib/iptables.inc @@ -111,7 +111,8 @@ function setup_iptables_chains { ${VER_IPTABLES} -A FORWARD -j ${FwdFilter} if [ -x ${FWCONFIGDIR}/ipv${IPVER}/custom/nat.sh ]; then . ${FWCONFIGDIR}/ipv${IPVER}/custom/nat.sh; fi ${debug} ${DebugColor} "${FUNCNAME}:${DEFAULT_COLOR} Setting up NAT" - ${VER_IPTABLES} -A POSTROUTING -t nat -j ${NAT} + ([[ ${IP_VERSION} == "4" ]] && [[ ${Enablev4NAT} == "yes" ]]) && ${VER_IPTABLES} -A POSTROUTING -t nat -j ${NAT} + ([[ ${IP_VERSION} == "6" ]] && [[ ${Enablev6NAT} == "yes" ]]) && ${VER_IPTABLES} -A POSTROUTING -t nat -j ${NAT} if [ -x ${FWCONFIGDIR}/ipv${IPVER}/custom/portfw.sh ]; then . ${FWCONFIGDIR}/ipv${IPVER}/custom/portfw.sh; fi ${debug} ${DebugColor} "${FUNCNAME}:${DEFAULT_COLOR} Setting up PortForward" ${VER_IPTABLES} -A PREROUTING -t nat -j ${PortForward}