3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
MODULES_OPTIONAL_USE=modules
|
7 |
|
inherit autotools bash-completion-r1 linux-info linux-mod systemd
|
|
6 |
inherit autotools bash-completion-r1 linux-info systemd
|
8 |
7 |
|
9 |
8 |
DESCRIPTION="IPset tool for iptables, successor to ippool"
|
10 |
9 |
HOMEPAGE="https://ipset.netfilter.org/ https://git.netfilter.org/ipset/"
|
... | ... | |
12 |
11 |
|
13 |
12 |
LICENSE="GPL-2"
|
14 |
13 |
SLOT="0"
|
15 |
|
KEYWORDS="amd64 arm arm64 ~loong ppc ~ppc64 ~riscv x86"
|
|
14 |
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
|
16 |
15 |
|
17 |
16 |
RDEPEND="
|
18 |
|
>=net-firewall/iptables-1.4.7
|
|
17 |
>=net-firewall/iptables-1.8.9
|
19 |
18 |
net-libs/libmnl:=
|
20 |
19 |
"
|
21 |
20 |
DEPEND="${RDEPEND}"
|
... | ... | |
23 |
22 |
|
24 |
23 |
DOCS=( ChangeLog INSTALL README UPGRADE )
|
25 |
24 |
|
26 |
|
PATCHES=(
|
27 |
|
"${FILESDIR}"/${PN}-7.16-bashism.patch
|
28 |
|
)
|
29 |
|
|
30 |
25 |
# configurable from outside, e.g. /etc/portage/make.conf
|
31 |
26 |
IP_NF_SET_MAX=${IP_NF_SET_MAX:-256}
|
32 |
27 |
|
33 |
|
BUILD_TARGETS="modules"
|
34 |
|
MODULE_NAMES_ARG="kernel/net/netfilter/ipset/:${S}/kernel/net/netfilter/ipset"
|
35 |
|
MODULE_NAMES="xt_set(kernel/net/netfilter/ipset/:${S}/kernel/net/netfilter/)"
|
36 |
|
MODULE_NAMES+=" em_ipset(kernel/net/sched/:${S}/kernel/net/sched/)"
|
37 |
|
for i in ip_set{,_bitmap_{ip{,mac},port},_hash_{ip{,mac,mark,port{,ip,net}},mac,net{,port{,net},iface,net}},_list_set}; do
|
38 |
|
MODULE_NAMES+=" ${i}(${MODULE_NAMES_ARG})"
|
39 |
|
done
|
40 |
|
|
41 |
28 |
pkg_setup() {
|
42 |
29 |
get_version
|
43 |
30 |
CONFIG_CHECK="NETFILTER"
|
... | ... | |
49 |
36 |
#ERROR_NET_NS="ipset requires NET_NS (network namespace) support in your kernel."
|
50 |
37 |
CONFIG_CHECK+=" !PAX_CONSTIFY_PLUGIN"
|
51 |
38 |
ERROR_PAX_CONSTIFY_PLUGIN="ipset contains constified variables (#614896)"
|
52 |
|
|
53 |
|
build_modules=0
|
54 |
|
if use modules; then
|
55 |
|
if linux_config_src_exists && linux_chkconfig_builtin "MODULES" ; then
|
56 |
|
if linux_chkconfig_present "IP_NF_SET" || \
|
57 |
|
linux_chkconfig_present "IP_SET"; then #274577
|
58 |
|
eerror "There is IP{,_NF}_SET or NETFILTER_XT_SET support in your kernel."
|
59 |
|
eerror "Please either build ipset with modules USE flag disabled"
|
60 |
|
eerror "or rebuild kernel without IP_SET support and make sure"
|
61 |
|
eerror "there is NO kernel ip_set* modules in /lib/modules/<your_kernel>/... ."
|
62 |
|
die "USE=modules and in-kernel ipset support detected."
|
63 |
|
else
|
64 |
|
einfo "Modular kernel detected. Gonna build kernel modules..."
|
65 |
|
build_modules=1
|
66 |
|
fi
|
67 |
|
else
|
68 |
|
eerror "Nonmodular kernel detected, but USE=modules. Either build"
|
69 |
|
eerror "modular kernel (without IP_SET) or disable USE=modules"
|
70 |
|
die "Nonmodular kernel detected, will not build kernel modules"
|
71 |
|
fi
|
72 |
|
fi
|
73 |
|
[[ ${build_modules} -eq 1 ]] && linux-mod_pkg_setup
|
74 |
39 |
}
|
75 |
40 |
|
76 |
41 |
src_prepare() {
|
77 |
42 |
default
|
78 |
|
|
79 |
43 |
eautoreconf
|
80 |
44 |
}
|
81 |
45 |
|
... | ... | |
84 |
48 |
|
85 |
49 |
econf \
|
86 |
50 |
--enable-bashcompl \
|
87 |
|
$(use_with modules kmod) \
|
88 |
|
--with-maxsets=${IP_NF_SET_MAX} \
|
89 |
|
--with-ksource="${KV_DIR}" \
|
90 |
|
--with-kbuild="${KV_OUT_DIR}"
|
91 |
|
}
|
92 |
|
|
93 |
|
src_compile() {
|
94 |
|
einfo "Building userspace"
|
95 |
|
emake
|
96 |
|
|
97 |
|
if [[ ${build_modules} -eq 1 ]]; then
|
98 |
|
einfo "Building kernel modules"
|
99 |
|
set_arch_to_kernel
|
100 |
|
emake modules
|
101 |
|
fi
|
|
51 |
--with-kmod=no \
|
|
52 |
--with-maxsets=${IP_NF_SET_MAX}
|
102 |
53 |
}
|
103 |
54 |
|
104 |
55 |
src_install() {
|
... | ... | |
111 |
62 |
newconfd "${FILESDIR}"/ipset.confd-r1 ${PN}
|
112 |
63 |
systemd_newunit "${FILESDIR}"/ipset.systemd-r1 ${PN}.service
|
113 |
64 |
keepdir /var/lib/ipset
|
114 |
|
|
115 |
|
if [[ ${build_modules} -eq 1 ]]; then
|
116 |
|
einfo "Installing kernel modules"
|
117 |
|
linux-mod_src_install
|
118 |
|
fi
|
119 |
65 |
}
|