diff --git a/Shorewall/lib.base b/Shorewall/lib.base index c53e7716e..8486f8791 100644 --- a/Shorewall/lib.base +++ b/Shorewall/lib.base @@ -1203,6 +1203,7 @@ do_log_rule_limit() # $1 = log level, $2 = chain, $3 = display Chain $4 = dispos local command=${7:--A} local prefix local base=$(chain_base $displayChain) + local pf limit="${5:-$LOGLIMIT}" # Do this here rather than in the declaration above to appease /bin/ash. @@ -1214,11 +1215,16 @@ do_log_rule_limit() # $1 = log level, $2 = chain, $3 = display Chain $4 = dispos fi if [ -n "$LOGRULENUMBERS" ]; then + # + # Hack for broken printf on some lightweight shells + # + [ $(printf "%d" 1) = "1" ] && pf=printf || pf=$(mywhich printf) + eval rulenum=\$${base}_logrules rulenum=${rulenum:-1} - prefix="$(printf "$LOGFORMAT" $displayChain $rulenum $disposition)${tag}" + prefix="$($pf "$LOGFORMAT" $displayChain $rulenum $disposition)${tag}" rulenum=$(($rulenum + 1)) eval ${base}_logrules=$rulenum