From: Henry Lee <henryronlee@gmail.com>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: Michal Kubecek <mkubecek@suse.cz>,
pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org
Subject: Re: PROBLEM: Netfilter time matching matches all packets when time start and time stop is the same
Date: Fri, 02 Aug 2013 11:18:54 +0800 [thread overview]
Message-ID: <51FB251E.9040605@gmail.com> (raw)
In-Reply-To: <CAHo-Ooz+Wz23kMBL-LgWw6HxpzQr7hJYJZNWkinOyCB1w+41zw@mail.gmail.com>
On 08/02/2013 09:35 AM, Maciej Żenczykowski wrote:
> Does having timestart == timestop make any sense?
> Why would you want to do that?
>
> Perhaps make iptables reject such input?
>
> On Thu, Aug 1, 2013 at 4:24 AM, Michal Kubecek <mkubecek@suse.cz> wrote:
>> On Wed, Jul 31, 2013 at 04:42:15PM +0800, Henry Lee wrote:
>>> diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
>>> index 0ae55a3..753573c 100644
>>> --- a/net/netfilter/xt_time.c
>>> +++ b/net/netfilter/xt_time.c
>>> @@ -192,7 +192,7 @@ time_mt(const struct sk_buff *skb, struct
>>> xt_action_param *par)
>>>
>>> packet_time = localtime_1(¤t_time, stamp);
>>>
>>> - if (info->daytime_start < info->daytime_stop) {
>>> + if (info->daytime_start <= info->daytime_stop) {
>>> if (packet_time < info->daytime_start ||
>>> packet_time > info->daytime_stop)
>>> return false;
>>>
>> As far as I can see, this would cause only packets arriving at midnight
>> to match by default (i.e. without both --timestart and --timestop).
>>
>> Michal Kubecek
>>
Dear Mr Kubecek,
I can see that iptables uses 00:00:00 and 23:59:59 as the default value
of timestart and timestop. In this case, even if both timestart and
timestop are not defined by user, it still works correctly.
Of cause, if some other tools use 00:00:00 and 00:00:00 as the default,
your concern will become a problem.
Dear Mr Żenczykowski,
I wouldn't use a timestart == timestop rule manually. But if I create
iptables rules in a program or a script, this case may happen.
Rejecting this rule seems a little bit harsh, in my opinion, since it
doesn't look so unacceptable.
Thank you both for your time.
Yours faithfully,
Henry Lee
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-08-02 3:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 8:42 PROBLEM: Netfilter time matching matches all packets when time start and time stop is the same Henry Lee
2013-08-01 11:24 ` Michal Kubecek
2013-08-02 1:35 ` Maciej Żenczykowski
2013-08-02 3:18 ` Henry Lee [this message]
2013-08-08 16:02 ` Pablo Neira Ayuso
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=51FB251E.9040605@gmail.com \
--to=henryronlee@gmail.com \
--cc=coreteam@netfilter.org \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=mkubecek@suse.cz \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zenczykowski@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).