diff options
author | Omar Vega Ramos <ovruni@gnu.org.pe> | 2015-08-28 20:17:06 -0500 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-22 16:14:58 -0300 |
commit | 90cdef590d9a809d8aaa379d7b7af0a7be21669a (patch) | |
tree | 58687b5da505377ea94028d9e6498061dafcf932 /pcr/openrc-net/iptables-1.4.13-r1.init | |
parent | 34e667f817febcd3589e20b9d0dcb8cbf6c95fd7 (diff) | |
download | abslibre-90cdef590d9a809d8aaa379d7b7af0a7be21669a.tar.gz abslibre-90cdef590d9a809d8aaa379d7b7af0a7be21669a.tar.bz2 abslibre-90cdef590d9a809d8aaa379d7b7af0a7be21669a.zip |
openrc-net-20150828-1: updating version
Diffstat (limited to 'pcr/openrc-net/iptables-1.4.13-r1.init')
-rw-r--r-- | pcr/openrc-net/iptables-1.4.13-r1.init | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/pcr/openrc-net/iptables-1.4.13-r1.init b/pcr/openrc-net/iptables-1.4.13-r1.init deleted file mode 100644 index a63d07688..000000000 --- a/pcr/openrc-net/iptables-1.4.13-r1.init +++ /dev/null @@ -1,130 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.4.13-r1.init,v 1.3 2013/04/27 17:29:09 vapier Exp $ - -extra_commands="check save panic" -extra_started_commands="reload" - -iptables_name=${SVCNAME} -case ${iptables_name} in -iptables|ip6tables) ;; -*) iptables_name="iptables" ;; -esac - -iptables_bin="/sbin/${iptables_name}" -case ${iptables_name} in - iptables) iptables_proc="/proc/net/ip_tables_names" - iptables_save=${IPTABLES_SAVE};; - ip6tables) iptables_proc="/proc/net/ip6_tables_names" - iptables_save=${IP6TABLES_SAVE};; -esac - -depend() { - need localmount #434774 - before net -} - -set_table_policy() { - local chains table=$1 policy=$2 - case ${table} in - nat) chains="PREROUTING POSTROUTING OUTPUT";; - mangle) chains="PREROUTING INPUT FORWARD OUTPUT POSTROUTING";; - filter) chains="INPUT FORWARD OUTPUT";; - *) chains="";; - esac - local chain - for chain in ${chains} ; do - ${iptables_bin} -t ${table} -P ${chain} ${policy} - done -} - -checkkernel() { - if [ ! -e ${iptables_proc} ] ; then - eerror "Your kernel lacks ${iptables_name} support, please load" - eerror "appropriate modules and try again." - return 1 - fi - return 0 -} -checkconfig() { - if [ ! -f ${iptables_save} ] ; then - eerror "Not starting ${iptables_name}. First create some rules then run:" - eerror "/etc/init.d/${iptables_name} save" - return 1 - fi - return 0 -} - -start() { - checkconfig || return 1 - ebegin "Loading ${iptables_name} state and starting firewall" - ${iptables_bin}-restore ${SAVE_RESTORE_OPTIONS} < "${iptables_save}" - eend $? -} - -stop() { - if [ "${SAVE_ON_STOP}" = "yes" ] ; then - save || return 1 - fi - checkkernel || return 1 - ebegin "Stopping firewall" - local a - for a in $(cat ${iptables_proc}) ; do - set_table_policy $a ACCEPT - - ${iptables_bin} -F -t $a - ${iptables_bin} -X -t $a - done - eend $? -} - -reload() { - checkkernel || return 1 - checkrules || return 1 - ebegin "Flushing firewall" - local a - for a in $(cat ${iptables_proc}) ; do - ${iptables_bin} -F -t $a - ${iptables_bin} -X -t $a - done - eend $? - - start -} - -checkrules() { - ebegin "Checking rules" - ${iptables_bin}-restore --test ${SAVE_RESTORE_OPTIONS} < "${iptables_save}" - eend $? -} - -check() { - # Short name for users of init.d script. - checkrules -} - -save() { - ebegin "Saving ${iptables_name} state" - checkpath -q -d "$(dirname "${iptables_save}")" - checkpath -q -m 0600 -f "${iptables_save}" - ${iptables_bin}-save ${SAVE_RESTORE_OPTIONS} > "${iptables_save}" - eend $? -} - -panic() { - checkkernel || return 1 - if service_started ${iptables_name}; then - rc-service ${iptables_name} stop - fi - - local a - ebegin "Dropping all packets" - for a in $(cat ${iptables_proc}) ; do - ${iptables_bin} -F -t $a - ${iptables_bin} -X -t $a - - set_table_policy $a DROP - done - eend $? -} |