From: Brad Fisher <brad@info-link.net>
To: Brad Fisher <brad@info-link.net>
Cc: netfilter-devel@lists.netfilter.org,
Samuel Jean <sj-netfilter@cookinglinux.org>
Subject: Re: ipt_time fixes (resend, sorry)
Date: Fri, 14 Jan 2005 10:35:05 -0600 [thread overview]
Message-ID: <41E7F4B9.4080103@info-link.net> (raw)
In-Reply-To: <41E7F2DA.608@info-link.net>
Brad Fisher wrote:
> Krzysztof Oledzki wrote:
>
>>
>> - packet_local_time = skb->stamp.tv_sec;
>> + /* We might not have a timestamp, get one */
>> + if (skb->stamp.tv_sec == 0)
>> + do_gettimeofday((struct timeval *)&skb->stamp);
>>
>> /* First we make sure we are in the date start-stop boundaries */
>> - if ((packet_local_time < info->date_start) || (packet_local_time
>> > info->date_stop))
>> + if ((skb->stamp.tv_sec < info->date_start) || (skb->stamp.tv_sec
>> > info->date_stop))
>> return 0; /* We are outside the date boundaries */
>>
> I'd like to see the above like become:
>
> + if ((skb->stamp.tv_sec >= info->date_start) && (skb->stamp.tv_sec
> <= info->date_stop))
> return 0; /* We are outside the date boundaries */
>
> This will have the same logic in most situations, and fix a problem
> with the time match where you need 2 rules to match something like all
> times between 20:00-04:00 (ie. the start time is "greater" than the
> end time). I've used something similar for years and enjoy not
> needing multiple rules for this. I also have a patch (and I believe
> I've submitted it in the past) for grabbing the kernel time if no time
> is known (and with that patch, or what's being discussed here, I
> believe the time match should work in any chain).
>
> -Brad Fisher
>
>
> !DSPAM:41e7f37a167171105578672!
>
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.
-Brad
next prev parent reply other threads:[~2005-01-14 16:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-14 14:04 ipt_time fixes (resend, sorry) Krzysztof Oledzki
2005-01-14 14:37 ` Bill Rugolsky Jr.
2005-01-14 14:48 ` Krzysztof Oledzki
2005-01-14 15:32 ` Samuel Jean
2005-01-14 15:24 ` Krzysztof Oledzki
2005-01-14 16:27 ` Brad Fisher
2005-01-14 16:35 ` Brad Fisher [this message]
2005-01-20 13:40 ` Krzysztof Oledzki
2005-01-20 16:35 ` Brad Fisher
2005-01-20 17:18 ` Krzysztof Oledzki
2005-01-20 18:33 ` Samuel Jean
2005-01-20 18:45 ` Brad Fisher
2005-01-20 22:54 ` Krzysztof Oledzki
2005-01-21 0:23 ` Samuel Jean
2005-02-01 12:06 ` Harald Welte
2005-02-01 16:52 ` Krzysztof Oledzki
2005-02-15 0:57 ` Harald Welte
2005-04-05 8:18 ` Krzysztof Oledzki
2005-04-10 20:26 ` Harald Welte
2005-04-12 18:45 ` Krzysztof Oledzki
2005-01-14 22:47 ` Samuel Jean
[not found] ` <200502030010.47260.fabrice.marie@fma-rms.com>
[not found] ` <Pine.LNX.4.62.0502150219100.17929@bizon.gios.gov.pl>
2005-02-15 15:23 ` Fabrice MARIE
2005-02-15 15:58 ` Krzysztof Oledzki
2005-02-16 15:24 ` Fabrice MARIE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41E7F4B9.4080103@info-link.net \
--to=brad@info-link.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=sj-netfilter@cookinglinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.