Forum Discussion
Nov 03, 2020
Hi Ashu,
Can you replace lines 20-24? (set denied values)
if { ($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end]) } {
set denied 1
}
else {
set denied 0
}
when RULE_INIT {
array set static::timerange {
Monday {}
Tuesday {}
Wednesday {}
Thursday {"03:15" "03:30"}
Friday {}
Saturday {}
Sunday {}
}
}
when HTTP_REQUEST {
if { not [class match [IP::client_addr] equals dg_allow_ip_during_deployment] } {
set now [clock seconds]
set current_day [clock format $now -format {%A}]
set start [lindex $static::timerange($current_day) 0]
set end [lindex $static::timerange($current_day) 1]
if { ($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end]) } {
set denied 1
} else {
set denied 0
}
unset start end
} else {
set denied 0
}
if { $denied } {
drop
}
}