netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
@ 2008-06-21  7:54 Joonwoo Park
  2008-06-21  8:16 ` Patrick McHardy
  2008-06-29 14:29 ` Jan Engelhardt
  0 siblings, 2 replies; 8+ messages in thread
From: Joonwoo Park @ 2008-06-21  7:54 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: netdev, netfilter-devel, Thomas Graf, Pablo Neira Ayuso,
	Joonwoo Park

icase of xt_string_info indicates case [in]sensitive matching.
netfilter can find cmd.exe, Cmd.exe, cMd.exe and etc easily.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 include/linux/netfilter/xt_string.h |    1 +
 net/netfilter/xt_string.c           |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index bb21dd1..dfd347f 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -12,6 +12,7 @@ struct xt_string_info
 	char 	  pattern[XT_STRING_MAX_PATTERN_SIZE];
 	u_int8_t  patlen;
 	u_int8_t  invert;
+	u_int8_t  icase;
 
 	/* Used internally by the kernel */
 	struct ts_config __attribute__((aligned(8))) *config;
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c
index 9508484..7c83431 100644
--- a/net/netfilter/xt_string.c
+++ b/net/netfilter/xt_string.c
@@ -55,7 +55,7 @@ string_mt_check(const char *tablename, const void *ip,
 	if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
 		return false;
 	ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
-				     0, GFP_KERNEL, TS_AUTOLOAD);
+				     conf->icase, GFP_KERNEL, TS_AUTOLOAD);
 	if (IS_ERR(ts_conf))
 		return false;
 
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-21  7:54 [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching Joonwoo Park
@ 2008-06-21  8:16 ` Patrick McHardy
  2008-06-29 14:29 ` Jan Engelhardt
  1 sibling, 0 replies; 8+ messages in thread
From: Patrick McHardy @ 2008-06-21  8:16 UTC (permalink / raw)
  To: Joonwoo Park; +Cc: netdev, netfilter-devel, Thomas Graf, Pablo Neira Ayuso

Joonwoo Park wrote:
> icase of xt_string_info indicates case [in]sensitive matching.
> netfilter can find cmd.exe, Cmd.exe, cMd.exe and etc easily.
> 
> Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
> ---
>  include/linux/netfilter/xt_string.h |    1 +
>  net/netfilter/xt_string.c           |    2 +-
>  2 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
> index bb21dd1..dfd347f 100644
> --- a/include/linux/netfilter/xt_string.h
> +++ b/include/linux/netfilter/xt_string.h
> @@ -12,6 +12,7 @@ struct xt_string_info
>  	char 	  pattern[XT_STRING_MAX_PATTERN_SIZE];
>  	u_int8_t  patlen;
>  	u_int8_t  invert;
> +	u_int8_t  icase;
>  
>  	/* Used internally by the kernel */
>  	struct ts_config __attribute__((aligned(8))) *config;


A few words for the changelog why this won't break compatibility
by changing the data structure would be nice, especially
considering CRIS that doesn't perform any padding itself (you
might be lucky though because of aligned attribute, but please
verify that yourself).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-21  7:54 [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching Joonwoo Park
  2008-06-21  8:16 ` Patrick McHardy
@ 2008-06-29 14:29 ` Jan Engelhardt
  2008-06-30 18:44   ` Joonwoo Park
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Engelhardt @ 2008-06-29 14:29 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: Patrick McHardy, netdev, netfilter-devel, Thomas Graf,
	Pablo Neira Ayuso


On Saturday 2008-06-21 09:54, Joonwoo Park wrote:

>icase of xt_string_info indicates case [in]sensitive matching.
>netfilter can find cmd.exe, Cmd.exe, cMd.exe and etc easily.
>
>Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
>---
> include/linux/netfilter/xt_string.h |    1 +
> net/netfilter/xt_string.c           |    2 +-
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
>diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
>index bb21dd1..dfd347f 100644
>--- a/include/linux/netfilter/xt_string.h
>+++ b/include/linux/netfilter/xt_string.h
>@@ -12,6 +12,7 @@ struct xt_string_info
> 	char 	  pattern[XT_STRING_MAX_PATTERN_SIZE];
> 	u_int8_t  patlen;
> 	u_int8_t  invert;
>+	u_int8_t  icase;
> 
> 	/* Used internally by the kernel */
> 	struct ts_config __attribute__((aligned(8))) *config;

Why not just doing it this way?


enum {
	XT_STRING_INVERT = 1 << 0,
	XT_STRING_ICASE  = 1 << 1,
};

struct xt_string_info {
	...
	union {
		uint8_t invert;
		uint8_t flags;
	};
	...
};


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-29 14:29 ` Jan Engelhardt
@ 2008-06-30 18:44   ` Joonwoo Park
  2008-06-30 19:09     ` Jan Engelhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Joonwoo Park @ 2008-06-30 18:44 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Patrick McHardy, netdev, netfilter-devel, Thomas Graf,
	Pablo Neira Ayuso

2008/6/29 Jan Engelhardt <jengelh@medozas.de>:
>
> On Saturday 2008-06-21 09:54, Joonwoo Park wrote:
>
>>icase of xt_string_info indicates case [in]sensitive matching.
>>netfilter can find cmd.exe, Cmd.exe, cMd.exe and etc easily.
>>
>>Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
>>---
>> include/linux/netfilter/xt_string.h |    1 +
>> net/netfilter/xt_string.c           |    2 +-
>> 2 files changed, 2 insertions(+), 1 deletions(-)
>>
>>diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
>>index bb21dd1..dfd347f 100644
>>--- a/include/linux/netfilter/xt_string.h
>>+++ b/include/linux/netfilter/xt_string.h
>>@@ -12,6 +12,7 @@ struct xt_string_info
>>       char      pattern[XT_STRING_MAX_PATTERN_SIZE];
>>       u_int8_t  patlen;
>>       u_int8_t  invert;
>>+      u_int8_t  icase;
>>
>>       /* Used internally by the kernel */
>>       struct ts_config __attribute__((aligned(8))) *config;
>
> Why not just doing it this way?
>
>
> enum {
>        XT_STRING_INVERT = 1 << 0,
>        XT_STRING_ICASE  = 1 << 1,
> };
>
> struct xt_string_info {
>        ...
>        union {
>                uint8_t invert;
>                uint8_t flags;
>        };
>        ...
> };
>
>

Not bad for me,
I think invert might be removed and flags can contain XT_STRING_INVERT as well.
But I guess we should do version checking between user-space and
kernel more strictly whatever.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-30 18:44   ` Joonwoo Park
@ 2008-06-30 19:09     ` Jan Engelhardt
  2008-06-30 19:32       ` Joonwoo Park
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Engelhardt @ 2008-06-30 19:09 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: Patrick McHardy, netdev, netfilter-devel, Thomas Graf,
	Pablo Neira Ayuso


On Monday 2008-06-30 20:44, Joonwoo Park wrote:
>> Why not just doing it this way?
>>
>>
>> enum {
>>        XT_STRING_INVERT = 1 << 0,
>>        XT_STRING_ICASE  = 1 << 1,
>> };
>>
>> struct xt_string_info {
>>        ...
>>        union {
>>                uint8_t invert;
>>                uint8_t flags;
>>        };
>>        ...
>> };
>>
>>
>
>Not bad for me,
>I think invert might be removed and flags can contain XT_STRING_INVERT as well.

Right, since we copy eader files anyway, we can just make it uint8_t flags
without the union.

>But I guess we should do version checking between user-space and
>kernel more strictly whatever.

That is what we have '.revision' in xt_match/xt_target for.
In this case however it should be fine with just flags.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-30 19:09     ` Jan Engelhardt
@ 2008-06-30 19:32       ` Joonwoo Park
  2008-06-30 20:04         ` Patrick McHardy
  0 siblings, 1 reply; 8+ messages in thread
From: Joonwoo Park @ 2008-06-30 19:32 UTC (permalink / raw)
  To: Jan Engelhardt, Patrick McHardy, Thomas Graf
  Cc: netdev, netfilter-devel, Pablo Neira Ayuso

2008/6/30 Jan Engelhardt <jengelh@medozas.de>:
> Right, since we copy eader files anyway, we can just make it uint8_t flags
> without the union.

I like it :-)
Patrick, Thomas, If you want I'll send this fix with version checking patch.

>
>>But I guess we should do version checking between user-space and
>>kernel more strictly whatever.
>
> That is what we have '.revision' in xt_match/xt_target for.
> In this case however it should be fine with just flags.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-30 19:32       ` Joonwoo Park
@ 2008-06-30 20:04         ` Patrick McHardy
  2008-07-01  7:10           ` Joonwoo Park
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick McHardy @ 2008-06-30 20:04 UTC (permalink / raw)
  To: Joonwoo Park
  Cc: Jan Engelhardt, Thomas Graf, netdev, netfilter-devel,
	Pablo Neira Ayuso

Joonwoo Park wrote:
> 2008/6/30 Jan Engelhardt <jengelh@medozas.de>:
>> Right, since we copy eader files anyway, we can just make it uint8_t flags
>> without the union.
> 
> I like it :-)
> Patrick, Thomas, If you want I'll send this fix with version checking patch.

Yes, please also include the suggestions I made previously
that still apply (should be all of them).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching
  2008-06-30 20:04         ` Patrick McHardy
@ 2008-07-01  7:10           ` Joonwoo Park
  0 siblings, 0 replies; 8+ messages in thread
From: Joonwoo Park @ 2008-07-01  7:10 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: Jan Engelhardt, Thomas Graf, netdev, netfilter-devel,
	Pablo Neira Ayuso

2008/6/30 Patrick McHardy <kaber@trash.net>:
> Joonwoo Park wrote:
>>
>> 2008/6/30 Jan Engelhardt <jengelh@medozas.de>:
>>>
>>> Right, since we copy eader files anyway, we can just make it uint8_t
>>> flags
>>> without the union.
>>
>> I like it :-)
>> Patrick, Thomas, If you want I'll send this fix with version checking
>> patch.
>
> Yes, please also include the suggestions I made previously
> that still apply (should be all of them).
>

ok, as soon as I finish travel, I'll catch up your suggestions, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-01  7:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21  7:54 [PATCH 6/8] netfilter: fix string extension for case insensitive pattern matching Joonwoo Park
2008-06-21  8:16 ` Patrick McHardy
2008-06-29 14:29 ` Jan Engelhardt
2008-06-30 18:44   ` Joonwoo Park
2008-06-30 19:09     ` Jan Engelhardt
2008-06-30 19:32       ` Joonwoo Park
2008-06-30 20:04         ` Patrick McHardy
2008-07-01  7:10           ` Joonwoo Park

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).