KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
IUSE="conntrack ipv6 netlink nftables pcap static-libs"
+BUILD_DEPEND="
+ >=app-eselect/eselect-iptables-20200508
+"
COMMON_DEPEND="
- app-eselect/eselect-iptables
conntrack? ( >=net-libs/libnetfilter_conntrack-1.0.6 )
netlink? ( net-libs/libnfnetlink )
nftables? (
virtual/os-headers
>=sys-kernel/linux-headers-4.4:0
"
-BDEPEND="
+BDEPEND="${BUILD_DEPEND}
+ app-eselect/eselect-iptables
virtual/pkgconfig
nftables? (
sys-devel/flex
)
"
RDEPEND="${COMMON_DEPEND}
+ ${BUILD_DEPEND}
nftables? ( net-misc/ethertypes )
+ !<net-firewall/ebtables-2.0.11-r1
+ !<net-firewall/arptables-0.0.5-r1
"
PATCHES=(
# Bug 647458
rm "${ED}"/etc/ethertypes || die
- # Bug 660886
- rm "${ED}"/sbin/{arptables,ebtables} || die
-
- # Bug 669894
- rm "${ED}"/sbin/ebtables-{save,restore} || die
+ # Bugs 660886 and 669894
+ rm "${ED}"/sbin/{arptables,ebtables}{,-{save,restore}} || die
fi
systemd_dounit "${FILESDIR}"/systemd/iptables-{re,}store.service
if ! eselect iptables show &>/dev/null; then
elog "Current iptables implementation is unset, setting to ${default_iptables}"
eselect iptables set "${default_iptables}"
- use ipv6 && eselect iptables set --ipv6 "${default_iptables}"
fi
+
+ if use nftables; then
+ local tables
+ for tables in {arp,eb}tables; do
+ if ! eselect ${tables} show &>/dev/null; then
+ elog "Current ${tables} implementation is unset, setting to ${default_iptables}"
+ eselect ${tables} set xtables-nft-multi
+ fi
+ done
+ fi
+
eselect iptables show
}
elog "Unsetting iptables symlinks before removal"
eselect iptables unset
+ if ! has_version 'net-firewall/ebtables'; then
+ elog "Unsetting ebtables symlinks before removal"
+ eselect ebtables unset
+ elif [[ -z ${REPLACED_BY_VERSION} ]]; then
+ elog "Resetting ebtables symlinks to ebtables-legacy"
+ eselect ebtables set ebtables-legacy
+ fi
+
+ if ! has_version 'net-firewall/arptables'; then
+ elog "Unsetting arptables symlinks before removal"
+ eselect arptables unset
+ elif [[ -z ${REPLACED_BY_VERSION} ]]; then
+ elog "Resetting arptables symlinks to arptables-legacy"
+ eselect arptables set arptables-legacy
+ fi
+
# the eselect module failing should not be fatal
return 0
}