I have enclosed a patch which allows ipfw2 to filter based on the time of day. Mostly looking for approval/testers. I have tested this patch but it may be missing something. CAVEATS As noted in the BUGS section of the ipfw.8 diff, if your system shifts its time for daylight savings, firewall rules will have to be refreshed, because the kernel is not aware of such things. QUICK EXAMPLE ipfw add allow ip from any to any times 09:00:00 17:00:00 Allow all IP traffic from 9:00 AM to 5:00 PM. Thanks, enjoy! Christian S.J. Peron How-To-Repeat: N/A
Responsible Changed From-To: freebsd-bugs->ipfw Assign this to the ipfw maintainers.
suggest using 'time_second' instead of microtime() in ipfw_chk(). case O_TIME: { u_long from, to, sum; long tzoff; tzoff = ((ipfw_insn_time *)cmd)->tzoff; from = ((ipfw_insn_time *)cmd)->from; to = ((ipfw_insn_time *)cmd)->to; sum = ipfw_calc_time_sum(time_second + t zoff); match = (sum >= from && sum <= to); } break;
State Changed From-To: open->suspended Personally i recommend to use sets of rules and switch between them with cron(8). But maybe someone will find this feature interesting, so i suspend this PR.
Suggested feature has not get attention for 15 years. Also, it is much more practical to manage time-based ipfw rules from userland (cron etc.) as ae@ noted because of daylight changes, time zone updates etc.