From: Michael Tremer Date: Wed, 3 Oct 2012 16:23:39 +0000 (+0000) Subject: iptables: Add some assertions and call external commands with cmd. X-Git-Tag: 005~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2239db91fc3dd55a2bda9afbd36217a1494e8e1f;p=network.git iptables: Add some assertions and call external commands with cmd. --- diff --git a/functions.iptables b/functions.iptables index 2a9f4389..98658bbe 100644 --- a/functions.iptables +++ b/functions.iptables @@ -104,6 +104,8 @@ function iptables() { esac rulesfile=$(iptables_rulesfile ipv${p} ${table}) + assert isset rulesfile + print "${args:1:${#args}}" >> ${rulesfile} done } @@ -113,7 +115,7 @@ function _iptables() { local iptables_cmd=$(which iptables) assert isset iptables_cmd - ${iptables_cmd} $@ + cmd ${iptables_cmd} $@ } function iptables_status() { @@ -211,6 +213,7 @@ function iptables_load() { # First check if everything is correctly formatted. for proto in 6 4; do rulesfile=$(iptables_rulesfile ipv${proto}) + assert isset rulesfile _iptables_load ipv${proto} ${rulesfile} true if [ $? -ne ${EXIT_OK} ]; then