From: Heiko Schlittermann <hs@schlittermann.de>
To: netfilter-devel@lists.netfilter.org
Subject: Patch for ipt_time (to enable start > stop / crossing midnight)
Date: Wed, 4 Jan 2006 15:27:50 +0100 [thread overview]
Message-ID: <20060104142750.GF15217@schlittermann.de> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1135 bytes --]
Hello,
orginally sent to Fabrice but resending it here. (Fabrice doesn't seem to
have time...., so I just subscribed here.)
(Beside: I was wondering, why ipt_time is not part of the official
2.6. kernel -- did I miss something?)
So I applied the `time' patch from current patch-o-matic (20060101).
But with a rule like:
iptables -A INPUT -m time --timestart 21:00 --timestop 15:00 -j ...
(wrapping 'round midnight).
I missed my target :)
To enable times crossing midnight I hacked a bit in ipt_time.c. My diff
is appended (against the patch-o-matic 20060101)..
It would be nice if you could
1) check it
2) integrate it into the official patch-o-matic (and kernel tree?)
Thank you ...
Best regards from Dresden
Viele Grüße aus Dresden
Heiko Schlittermann
--
SCHLITTERMANN.de ---------------------------- internet & unix support -
Heiko Schlittermann HS12-RIPE -----------------------------------------
gnupg encrypted messages are welcome - key ID: 48D0359B ---------------
gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B -
[-- Attachment #1.2: ipt_time.c.diff --]
[-- Type: text/plain, Size: 1067 bytes --]
--- ipt_time.c.orig 2005-11-03 19:20:25.000000000 +0100
+++ ipt_time.c 2006-01-03 10:14:35.000000000 +0100
@@ -11,6 +11,7 @@
2001-30-11 Fabrice : added the possibility to use the match in FORWARD/OUTPUT with a little hack,
added Nguyen Dang Phuoc Dong <dongnd@tlnet.com.vn> patch to support timezones.
2004-05-02 Fabrice : added support for date matching, from an idea of Fabien COELHO.
+ 2006-01-03 Heiko Schlittermann <hs@schlittermann.de> : added support for timestart > timestop
*/
#include <linux/module.h>
@@ -72,11 +73,14 @@
/* ... check the time now */
packet_time = (currenttime.tm_hour * 60) + currenttime.tm_min;
- if ((packet_time < info->time_start) || (packet_time > info->time_stop))
- return 0;
- /* here we match ! */
- return 1;
+ /* .hs now start > stop is possible */
+
+ if (info->time_start > info->time_stop)
+ return (packet_time >= info->time_start) || (packet_time < info->time_stop);
+
+ return (packet_time >= info->time_start) && (packet_time < info->time_stop);
+
}
static int
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2006-01-04 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-04 14:27 Heiko Schlittermann [this message]
2006-01-04 15:47 ` Patch for ipt_time (to enable start > stop / crossing midnight) Krzysztof Oledzki
2006-01-04 16:36 ` Brad Fisher
2006-01-04 17:09 ` Krzysztof Oledzki
2006-01-04 17:18 ` Brad Fisher
2006-01-04 16:44 ` Heiko Schlittermann
2006-01-04 16:58 ` Krzysztof Oledzki
2006-01-05 9:41 ` Heiko Schlittermann
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=20060104142750.GF15217@schlittermann.de \
--to=hs@schlittermann.de \
--cc=netfilter-devel@lists.netfilter.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.