All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Jean <sj-netfilter@cookinglinux.org>
To: Phil Oester <kernel@linuxace.com>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: Cannot delete hashlimit match entries
Date: Fri, 04 Feb 2005 19:33:04 -0500	[thread overview]
Message-ID: <42041440.1050405@cookinglinux.org> (raw)
In-Reply-To: <20050204232444.GB30789@linuxace.com>

Phil Oester wrote:
> As noted by a bugzilla reporter, 
> 
> iptables -A foo -m hashlimit --hashlimit 5/s --hashlimit-mode srcip --hashlimit-name foo
> iptables -D foo -m hashlimit --hashlimit 5/s --hashlimit-mode srcip --hashlimit-name foo
> iptables: Bad rule (does a matching rule exist in that chain?)
> 
> In reviewing this, I think the fact that *hinfo is initialized by the kernel
> will make this a tough problem to fix.  The unitialized match is:
> 

Yes. The only way am aware of to fix it is sizing the matching part with offsetof().
Fortunately, in this case, all modified member are at end so we can use this hack without
breaking any compatibility.

> Ideas?

Index: extensions/libipt_hashlimit.c
===================================================================
--- extensions/libipt_hashlimit.c       (revision 3525)
+++ extensions/libipt_hashlimit.c       (working copy)
@@ -351,8 +351,7 @@
         .name           = "hashlimit",
         .version        = IPTABLES_VERSION,
         .size           = IPT_ALIGN(sizeof(struct ipt_hashlimit_info)),
-       .userspacesize  = IPT_ALIGN(sizeof(struct ipt_hashlimit_info)),
-       //offsetof(struct ipt_hashlimit_info, prev),
+       .userspacesize  = offsetof(struct ipt_hashlimit_info, hinfo),
         .help           = &help,
         .init           = &init,
         .parse          = &parse,

By now, SVN is crush. 8( I can't tell wheter this patch applies or not. but at least, you got the idea.


> 
> Phil
> 

Cheers,
Samuel

  reply	other threads:[~2005-02-05  0:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-04 23:24 Cannot delete hashlimit match entries Phil Oester
2005-02-05  0:33 ` Samuel Jean [this message]
2005-02-07 18:41   ` 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=42041440.1050405@cookinglinux.org \
    --to=sj-netfilter@cookinglinux.org \
    --cc=kernel@linuxace.com \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=sjean@cookinglinux.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.