From: Patrick McHardy <kaber@trash.net>
To: Don Cohen <don-netf@isis.cs3-inc.com>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: Question: Variable sized matchinfo
Date: Tue, 21 Jan 2003 12:42:16 +0100 [thread overview]
Message-ID: <3E2D3218.1040805@trash.net> (raw)
In-Reply-To: <15916.60267.562015.732567@isis.cs3-inc.com>
Don Cohen wrote:
> > I want to write a match where it would be nice to pass a variable sized
> > matchinfo to kernelspace.
>The answer when I asked this question in connection with u32 was no.
>In fact,
>I asked:
> > Would it work to make that 10 into a module parm (or three) ?
>Harald answered:
> unfortunately not. The size of this structure needs to be known at
> compile time of the kernel and iptables userspace (and they have to be
> the same, obviously).
>
Oops, i probably missed that.
Anyway this doesn't seem to be real problem, you could just pass pointers
and copy_from_user the data. The probleme there is the match is not informed
if its not needed anymore, so no chance to free the memory.
>
> > Is this possible ? I want to avoid always using the largest possible
> > values (2^16 + a few bytes).
> > The data in question is a bpf program compiled with pcap_compile ..
> > This is probably not the most useful match but i think it beats u32
> > because bpf syntax is already well-known
> > and very pleasant to use.
>Thanks for the reference. I'll read about it. I assume you mean the
>u32 I posted recently.
>So far the bpf language doesn't strike me as pleasant to use compared
>to the small language I made up for u32, but maybe that's just cause
>I'm not used to it.
>I gather 2^16 is the maximum possible size of a bpf program.
>
no they are not limited in size AFAIK. I recently portet PPP_FILTERs to
isdn and
they chose a limit of 2^16 which sounds sane. But i missed its not 2^16
bytes
but 2^16 * sizeof(struct sock_fprog). If you want to look at a example
for using
sk_run_filter (matches bpf code in kernel) you can look at it at
http://trash.net/~kaber
>How about supplying several different variants of your module,
>one that has data size 128 bytes, another with size 1K, another 8K
>and finally 64K.
>
>
no i decided its too ugly to do stuff like this without beeing able to
either pass a variable-sized
struct from userspace (the size-check is done by the module itself, so
no problem there) or allocate
the memory in kernelspace myself (and free it afterwards). Both doesn't
seem like a big problem to do,
but it's not worth it for a just-for-fun match. Another uglyness is it
is not possible to display the bpf
code in userspace with iptables -L because its already compiled and
optimized. IIRC you ran into the same
problem with u32.
If anyone would really like a bpf match tell me and i might reconsider.
Patrick
next prev parent reply other threads:[~2003-01-21 11:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030120232634.24011.21218.Mailman@kashyyyk>
2003-01-21 6:19 ` conntrack hash function comparison Don Cohen
2003-01-21 11:12 ` Jozsef Kadlecsik
2003-01-21 16:59 ` Don Cohen
2003-01-31 11:41 ` Harald Welte
2003-02-01 0:41 ` Don Cohen
2003-02-01 6:57 ` Patrick Schaaf
2003-02-01 7:58 ` Don Cohen
2003-02-01 8:37 ` Harald Welte
2003-02-01 19:05 ` Don Cohen
2003-02-02 22:45 ` Harald Welte
2003-01-21 6:40 ` Question: Variable sized matchinfo Don Cohen
2003-01-21 11:42 ` Patrick McHardy [this message]
2003-01-21 16:07 ` Laszlo Valko
2003-01-21 16:32 ` [OT " Patrick McHardy
2003-01-21 16:46 ` Laszlo Valko
2003-01-20 12:14 Patrick McHardy
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=3E2D3218.1040805@trash.net \
--to=kaber@trash.net \
--cc=don-netf@isis.cs3-inc.com \
--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.