From: Pablo Neira <pablo@eurodev.net>
To: Sven Schuster <schuster.sven@gmx.de>
Cc: Harald Welte <laforge@netfilter.org>,
Netfilter Development Mailinglist
<netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH 1/4] RFC: fast string matching infrastrure for netfilter
Date: Tue, 11 Jan 2005 00:18:13 +0100 [thread overview]
Message-ID: <41E30D35.5040405@eurodev.net> (raw)
In-Reply-To: <20050110084939.GA11194@zion.homelinux.com>
Sven Schuster wrote:
>>+struct nf_string_match *
>>+nf_string_match_create(const char *pat, int patlen)
>>+{
>>+ struct nf_string_match *sm;
>>+
>>+ sm = kmalloc(sizeof(struct nf_string_match), GFP_KERNEL);
>>+ if (!sm)
>>+ return NULL;
>>+ memset(sm, 0, sizeof(struct nf_string_match));
>>+
>>+ sm->goodshift = (int *) kmalloc(patlen * sizeof(int), GFP_KERNEL);
>>+ if (!sm->goodshift)
>>+ return NULL;
>>+ memset(sm->goodshift, 0, sizeof(int) * patlen);
>>+
>>+ sm->pat = (char *) kmalloc(patlen * sizeof(int), GFP_KERNEL);
>>+ if (!sm->pat) {
>>+ kfree(sm->goodshift);
>>+ return NULL;
>>+ }
>>+ memset(sm->pat, patlen, sizeof(char) * patlen);
>>
>>
>
>is there any intention behind kmalloc()ing the pattern using sizeof(int)
>and then memset()ting it using sizeof(char)?
>
>
yes, I've got a severe brain misfunction or a leak in the copy-and-paste
facility of my editor :). Thanks, I just fixed those in my tree.
Harald, I'll wait for your news about your patches to reduce the
pressure in memory allocation. Anyway, I've already got some thoughts
about libqsearch. I think that it's a bit bloated for kernel space. That
plugin infrastructure provided by libqsearch is nice but it's much more
than we need since there are just just two plugins: brute force and
boyer-moore searchings.
My current implementation doesn't support wildcards[1] but that feature
isn't difficult to implement, as well as iterative searching of patterns
loaded in a list.
Wait for your comments.
[1] When talking about wildcards, I mean simple ones, that is, 'p*blo'
matches 'pablo' but not 'paablo' since boyer-moore shifting can't allow
that. I know you are aware of that ;).
--
Pablo
next prev parent reply other threads:[~2005-01-10 23:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-09 22:23 [PATCH 1/4] RFC: fast string matching infrastrure for netfilter Pablo Neira
2005-01-09 23:10 ` Patrick McHardy
2005-01-09 23:19 ` Pablo Neira
2005-01-10 19:54 ` nf_conntrack [was Re: [PATCH 1/4] RFC: fast string matching infrastrure for netfilter] Jozsef Kadlecsik
2005-01-10 20:31 ` Patrick McHardy
2005-01-10 21:28 ` Harald Welte
2005-01-14 2:45 ` Patrick McHardy
2005-01-14 4:31 ` nf_conntrack Yasuyuki KOZAKAI
2005-01-14 7:01 ` nf_conntrack [was Re: [PATCH 1/4] RFC: fast string matching infrastrure for netfilter] Rusty Russell
2005-01-14 8:20 ` Patrick Schaaf
2005-01-15 18:18 ` KOVACS Krisztian
2005-01-16 16:09 ` Jozsef Kadlecsik
2005-01-14 8:37 ` Harald Welte
2005-01-14 10:22 ` Rusty Russell
2005-01-14 18:02 ` Patrick McHardy
2005-01-14 17:52 ` Patrick McHardy
2005-01-14 8:31 ` Harald Welte
2005-01-14 18:00 ` Patrick McHardy
2005-01-14 3:16 ` Patrick McHardy
2005-01-10 21:20 ` Harald Welte
2005-01-10 8:49 ` [PATCH 1/4] RFC: fast string matching infrastrure for netfilter Sven Schuster
2005-01-10 23:18 ` Pablo Neira [this message]
2005-01-10 10:06 ` Harald Welte
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=41E30D35.5040405@eurodev.net \
--to=pablo@eurodev.net \
--cc=laforge@netfilter.org \
--cc=netfilter-devel@lists.netfilter.org \
--cc=schuster.sven@gmx.de \
/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.