Menu

#4 pceil and prate doesn't work in TIME section

open
nobody
None
5
2005-04-05
2005-04-05
Anonymous
No

I noticed that it is not possible to use pceil and
prate in TIME section for example the following doesn't
work :

TIME=08:00-23:59;64Kbit/10Kb,128Kbit
TIME=00:00-07:59;128Kbit/15Kb,pceil

I managed to fix this issue by modifying timecheck
function to look like this :

if [ $TIME_ABS -ge $BEG_ABS -a $TIME_ABS -lt $END_ABS
]; then
RATESPEC=${PARAMS%%,*}; CEILSPEC=${PARAMS##*,}

RNAME=""; CNAME=""
[ "$RATESPEC" = "prate" ] && RNAME=RATE_$PARENT
[ "$RATESPEC" = "pceil" ] && RNAME=CEIL_$PARENT
if [ -n "$RNAME" ]; then
RATESPEC=${!RNAME}
fi
[ "$CEILSPEC" = "prate" ] && CNAME=RATE_$PARENT
[ "$CEILSPEC" = "pceil" ] && CNAME=CEIL_$PARENT
if [ -n "$CNAME" ]; then
CEILSPEC=${!CNAME}
fi

[ "$RATESPEC" = "$CEILSPEC" ] && CEILSPEC=""

NEW_RATE=${RATESPEC%%/*}; NEW_BURST=${RATESPEC##*/}
[ "$NEW_RATE" = "$NEW_BURST" ] && NEW_BURST=""

NEW_CEIL=${CEILSPEC%%/*}; NEW_CBURST=${CEILSPEC##*/}
[ "$NEW_CEIL" = "$NEW_CBURST" ] && NEW_CBURST=""

MATCH=1
fi

Discussion


Log in to post a comment.

MongoDB Logo MongoDB