From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: xt_hashlimit: restore per-rule effectiveness
Date: Wed, 06 Oct 2010 15:54:18 +0200 [thread overview]
Message-ID: <4CAC7F8A.5080703@trash.net> (raw)
In-Reply-To: <1286346523-9476-2-git-send-email-jengelh@medozas.de>
Am 06.10.2010 08:28, schrieb Jan Engelhardt:
> When adding a second hashlimit rule with the same name, its parameters
> had no effect, because it had used a copy of the first one's inner
> state.
I'm not sure we can change this behaviour at this point. There's at
least one change in your patch that changes the default behaviour,
you can currently create a second rule for a table witout specifying
the mode and it will re-use the mode from the first rule. With your
patch this will result in an error due to the unfortunate fact that
the kernel doesn't check for valid modes. Having entries for rules
with different modes also would require to initalize all members
since a different rule might want to match on them. This again
doesn't work with the way masking is currently implemented.
> @@ -452,34 +456,34 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
>
> memset(dst, 0, sizeof(*dst));
>
> - switch (hinfo->family) {
> + switch (family) {
This also looks problematic, the entries don't include the family
themselves, so you're allowing tables to contain entries of multiple
families, which might cause mismatches.
> case NFPROTO_IPV4:
> - if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
> + if (info->cfg.mode & XT_HASHLIMIT_HASH_DIP)
> dst->ip.dst = maskl(ip_hdr(skb)->daddr,
> - hinfo->cfg.dstmask);
> - if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
> + info->cfg.dstmask);
> + if (info->cfg.mode & XT_HASHLIMIT_HASH_SIP)
> dst->ip.src = maskl(ip_hdr(skb)->saddr,
> - hinfo->cfg.srcmask);
> + info->cfg.srcmask);
>
> - if (!(hinfo->cfg.mode &
> + if (!(info->cfg.mode &
> (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
> return 0;
> nexthdr = ip_hdr(skb)->protocol;
> break;
next prev parent reply other threads:[~2010-10-06 13:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 6:28 xt_hashlimit: restore per-rule effectiveness Jan Engelhardt
2010-10-06 6:28 ` [PATCH] netfilter: " Jan Engelhardt
2010-10-06 13:54 ` Patrick McHardy [this message]
2010-10-06 15:00 ` Jan Engelhardt
2010-10-06 15:07 ` 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=4CAC7F8A.5080703@trash.net \
--to=kaber@trash.net \
--cc=jengelh@medozas.de \
--cc=netfilter-devel@vger.kernel.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.