]> git.karo-electronics.de Git - karo-tx-linux.git/commit
NETFILTER: xt_time: fix failure to match on Sundays
authorJan Engelhardt <jengelh@computergmbh.de>
Mon, 17 Mar 2008 14:41:44 +0000 (15:41 +0100)
committerChris Wright <chrisw@sous-sol.org>
Mon, 24 Mar 2008 18:47:47 +0000 (11:47 -0700)
commit32b4faa2b264717b37114bdbf0f799ab9d8a850b
tree1d06e9d70a6f56dd332d0a390d371e35fc0967d6
parent38f469963d11172bf68ebcb8c056bf4145c40241
NETFILTER: xt_time: fix failure to match on Sundays

Upstream commit 4f4c9430:

xt_time_match() in net/netfilter/xt_time.c in kernel 2.6.24 never
matches on Sundays. On my host I have a rule like

iptables -A OUTPUT -m time --weekdays Sun -j REJECT

and it never matches. The problem is in localtime_2(), which uses

    r->weekday = (4 + r->dse) % 7;

to map the epoch day onto a weekday in {0,...,6}. In particular this
gives 0 for Sundays. But 0 has to be wrong; a weekday of 0 can never
match. xt_time_match() has

    if (!(info->weekdays_match & (1 << current_time.weekday)))
        return false;

and when current_time.weekday = 0, the result of the & is always
zero, even when info->weekdays_match = XT_TIME_ALL_WEEKDAYS = 0xFE.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/netfilter/xt_time.c