Blame SOURCES/arptables-nft-helper

087bff
#!/bin/sh
087bff
087bff
ARPTABLES_CONFIG=/etc/sysconfig/arptables
087bff
087bff
# compat for removed initscripts dependency
087bff
087bff
success() {
087bff
	echo "[  OK  ]"
087bff
	return 0
087bff
}
087bff
087bff
failure() {
087bff
	echo "[FAILED]"
087bff
	return 1
087bff
}
087bff
087bff
start() {
087bff
	if [ ! -x /usr/sbin/arptables ]; then
087bff
		exit 4
087bff
	fi
087bff
087bff
	# don't do squat if we don't have the config file
087bff
	if [ -f $ARPTABLES_CONFIG ]; then
087bff
		printf "Applying arptables firewall rules: "
087bff
		/usr/sbin/arptables-restore < $ARPTABLES_CONFIG && \
087bff
			success || \
087bff
			failure
087bff
		touch /var/lock/subsys/arptables
087bff
	else
087bff
		failure
087bff
		echo "Configuration file /etc/sysconfig/arptables missing"
087bff
		exit 6
087bff
	fi
087bff
}
087bff
087bff
stop() {
087bff
	printf "Removing user defined chains: "
087bff
	arptables -X && success || failure
087bff
	printf "Flushing all chains: "
087bff
	arptables -F && success || failure
087bff
	printf "Resetting built-in chains to the default ACCEPT policy: "
087bff
	arptables -P INPUT ACCEPT && \
087bff
		arptables -P OUTPUT ACCEPT && \
087bff
		success || \
087bff
		failure
087bff
	rm -f /var/lock/subsys/arptables
087bff
}
087bff
087bff
case "$1" in
087bff
start)
087bff
	start
087bff
	;;
087bff
087bff
stop)
087bff
	stop
087bff
	;;
087bff
087bff
restart|reload)
087bff
	# "restart" is really just "start" as this isn't a daemon,
087bff
	# and "start" clears any pre-defined rules anyway.
087bff
	# This is really only here to make those who expect it happy
087bff
	start
087bff
	;;
087bff
087bff
condrestart|try-restart|force-reload)
087bff
	[ -e /var/lock/subsys/arptables ] && start
087bff
	;;
087bff
087bff
*)
087bff
	exit 2
087bff
esac
087bff
087bff
exit 0