if [ -n "${ip6tables_scripts}" ]; then
/etc/miniupnpd/ip6tables_init.sh || retval=${?}
fi
+ if [ -n "${nftables_scripts}" ]; then
+ /etc/miniupnpd/nft_init.sh || retval=${?}
+ fi
return ${retval}
}
if [ -n "${ip6tables_scripts}" ]; then
/etc/miniupnpd/ip6tables_removeall.sh
fi
+ if [ -n "${nftables_scripts}" ]; then
+ /etc/miniupnpd/nft_removeall.sh
+ fi
return ${retval}
}
<use>
<flag name="leasefile">Enable lease file.</flag>
<flag name="igd2">Build for IGDv2 instead of an IGDv1</flag>
+ <flag name="nftables">Use <pkg>net-firewall/nftables</pkg> rather than <pkg>net-firewall/iptables</pkg>.</flag>
<flag name="pcp-peer">Enable support for PCP-PEER to allow NAT-PMP clients to mangle their packets.</flag>
<flag name="portinuse">Check if a port is in use before allowing a NAT-PMP client to map it.</flag>
<flag name="strict">Be more strict regarding compliance with UPnP specifications.</flag>
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
-IUSE="+leasefile igd2 ipv6 pcp-peer portinuse strict"
+IUSE="+leasefile igd2 ipv6 nftables pcp-peer portinuse strict"
-RDEPEND=">=net-firewall/iptables-1.4.6:0=[ipv6?]
- net-libs/libnfnetlink:=
- net-libs/libmnl:=
+RDEPEND="
dev-libs/gmp:0=
sys-apps/util-linux:=
- dev-libs/openssl:0="
+ dev-libs/openssl:0=
+ !nftables? (
+ >=net-firewall/iptables-1.4.6:0=[ipv6?]
+ net-libs/libnfnetlink:=
+ net-libs/libmnl:=
+ )
+ nftables? (
+ net-firewall/nftables
+ net-libs/libnftnl:=
+ net-libs/libmnl:=
+ )"
DEPEND="${RDEPEND}
sys-apps/lsb-release"
src_prepare() {
default
- mv Makefile.linux Makefile || die
+
+ # Prevent overriding CFLAGS.
+ sed -i -e '/^CFLAGS =/d' Makefile.linux_nft || die
+
+ mv "Makefile.linux$(usex nftables _nft '')" Makefile || die
# Prevent gzipping manpage.
sed -i -e '/gzip/d' Makefile || die
src_install() {
emake PREFIX="${ED}" STRIP=true install
- local confd_seds=( -e ': noop' )
- use ipv6 || confd_seds+=( -e 's/^ip6tables_scripts=/#&/' )
+ local confd_seds=()
+ if use nftables; then
+ confd_seds+=( -e 's/^iptables_scripts=/#&/' )
+ else
+ confd_seds+=( -e 's/^nftables_scripts=/#&/' )
+ fi
+ if ! use ipv6 || use nftables; then
+ confd_seds+=( -e 's/^ip6tables_scripts=/#&/' )
+ fi
newinitd "${FILESDIR}"/${PN}-init.d-r2 ${PN}
newconfd - ${PN} < <(sed "${confd_seds[@]}" \