From: Patrick McHardy <kaber@trash.net>
To: Matthew Strait <quadong@users.sourceforge.net>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: childlevel's pom comment
Date: Thu, 04 Mar 2004 22:48:30 +0100 [thread overview]
Message-ID: <4047A42E.6080307@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.60.0403041500280.10634@dsl093-017-216.msp1.dsl.speakeasy.net>
Matthew Strait wrote:
>>I would prefer if "any" wouldn't need to be matched in the kernel,
>>something like:
>>
>>if (info->name[0] == '\0')
>> ret = !info->invert;
>>else
>> ...
>>
>>and have userspace do the "any" <=> "" translation.
>
>
> That would be fine with me, but iptables seems to consider the empty
> string to be an error condition:
>
> --- libipt_helper.c.old 2004-03-03 21:39:07.000000000 -0600
> +++ libipt_helper.c 2004-03-04 14:50:13.408377032 -0600
> @@ -46,6 +47,12 @@
> case '1':
> check_inverse(optarg, &invert, &invert, 0);
> strncpy(info->name, optarg, 29);
> +
> + /* special case, translate "any" to "" so the kernel
> + doesn't have to run strcmp. */
> + if(!strcmp(info->name, "any"))
> + info->name[0] = '\0';
> +
> if (invert)
> info->invert = 1;
> *flags = 1;
>
>
> root@quadong# iptables -A POSTROUTING -t mangle -m helper --helper any
> iptables: Invalid argument
>
> It seems like I'd have to make significantly more invasive changes than
> are really called for to get it to accept an empty string. What do you
> think?
You just need to remove the check for empty strings in ipt_helper.c:
/* verify that we actually should match anything */
if ( strlen(info->name) == 0 )
return 0;
Regards
Patrick
>
> -matthew
>
next prev parent reply other threads:[~2004-03-04 21:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-04 1:48 childlevel's pom comment quadong
2004-03-04 3:10 ` Patrick McHardy
2004-03-04 4:44 ` Matthew Strait
2004-03-04 5:33 ` Patrick McHardy
2004-03-04 21:10 ` Matthew Strait
2004-03-04 21:48 ` Patrick McHardy [this message]
2004-03-05 1:05 ` [PATCH] matching any helper in ipt_helper.c Matthew Strait
2004-03-05 2:13 ` Patrick McHardy
2004-03-05 9:23 ` Martin Josefsson
2004-03-05 7:14 ` Henrik Nordstrom
2004-03-04 22:47 ` childlevel's pom comment Henrik Nordstrom
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=4047A42E.6080307@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=quadong@users.sourceforge.net \
/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.