summaryrefslogtreecommitdiff
path: root/init.d.in/iptables.in
blob: 397a9ae7421d128007d08ca571457fd9dc7218f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!@OPENRC_RUN@

extra_commands="check"
extra_started_commands="reload"

iptables_name="${SVCNAME}"
iptables="@BINDIR@/${iptables_name}"

depend() {
	need localmount
	before net
}

checkrules() {
	${iptables}-restore --test "${IPTABLES_SAVE}"
}

start() {
	checkrules || return 1
	ebegin "Loading ${iptables_name} with rules from ${IPTABLES_SAVE}"
	${iptables}-restore "${IPTABLES_SAVE}"
	eend $?
}

reload() {
	start
}

stop() {
	ebegin "Flushing rules from ${iptables_name}"
	/usr/lib/systemd/scripts/iptables-flush >/dev/null
	eend $?
}