ipt_time fixes (resend, sorry)

Brad Fisher brad at info-link.net
Thu Jan 20 17:35:46 CET 2005


Krzysztof Oledzki wrote:

>>
>> Sorry for the additional spam :(
>>
>> The check should be changed to something like the following:
>>
>> +      if (info->date_start <= info->date_stop) {
>> +              /* normal order: start <= stop */
>> +              if ((skb->stamp.tv_sec < info->date_start) || 
>> (skb->stamp.tv_sec > info->date_stop))
>> +                        return 0;
>> +        } else {
>> +              /* reversed order: stop < start */
>> +                if ((skb->stamp.tv_sec < info->date_start) && 
>> (skb->stamp.tv_sec > info->date_stop))
>> +                        return 0;
>> +        }
>>
>> Sorry about the previous crap :)  Anyway, this only adds one more if 
>> test per packet, which in my opintion is acceptable when the 
>> alternative is an additional rule.
>
>
>
> OK.. You need to match 20:00-4:00, right? So why you just cannot 
> reverse the match of 4:00-20:00?
>
> Best regards,
>
>                 Krzysztof Olędzki
>
20:00 - 4:00 is very different from 4:00 - 20:00, one is a range of 8 
hours (20,21,22,23,0,1,2,3), the other is a range of 16 
(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)...  They are complementary 
to each other in terms of a 24 hour clock.

To match 20:00 - 4:00 you currently need 2 rules:
  1) match 20:00 - 23:59
  2) match 0:00 - 4:00
What I'm proposing is to allow this to be reduced to one rule.

-Brad Fisher




More information about the netfilter-devel mailing list