X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fnetfilter%2Fxt_time.c;h=9fa2e0824708f1acf62ab9c803a38eb4b4b2e408;hb=ff2bac6a63e3694e7a97152b7e934fe244e2a858;hp=e9a8794bc3ab6020c27cb6b73c24efd2b79201d1;hpb=bd45ac0c5daae35e7c71138172e63df5cf644cf6;p=linux-2.6 diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c index e9a8794bc3..9fa2e08247 100644 --- a/net/netfilter/xt_time.c +++ b/net/netfilter/xt_time.c @@ -95,8 +95,11 @@ static inline void localtime_2(struct xtm *r, time_t time) */ r->dse = time / 86400; - /* 1970-01-01 (w=0) was a Thursday (4). */ - r->weekday = (4 + r->dse) % 7; + /* + * 1970-01-01 (w=0) was a Thursday (4). + * -1 and +1 map Sunday properly onto 7. + */ + r->weekday = (4 + r->dse - 1) % 7 + 1; } static void localtime_3(struct xtm *r, time_t time)