Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: per j <perj8@hotmail.com>
Cc: netfilter@lists.netfilter.org, ipt_recent@snowman.net
Subject: Re: ipt_recent 0.3.0 --rttl still doesn't work  (I made a patch instead, can't wait)
Date: Mon, 3 Mar 2003 11:24:54 -0500	[thread overview]
Message-ID: <20030303162454.GN2721@ns.snowman.net> (raw)
In-Reply-To: <F208OXC80dFvgSFVA4R00035c2a@hotmail.com>

[-- Attachment #1: Type: text/plain, Size: 2798 bytes --]

* per j (perj8@hotmail.com) wrote:
> I've played around with -j TTL and no it doesn't have to do with the TTL 
> mangled in the FORWARD chain because all my rules with -m recent are in 
> INPUT chain or the beginning of the FORWARD chain before ACCEPT.

If your patch is against 0.3.0 then it may very well matter since your
patch doesn't remove the 'if(out) ttl++;' line from 0.3.0.  Could you
check for that?

> I tried out the ipt_recent-0.3.0 release and the problem still exists.  I 
> turned on debug and found out r_list[location].ttl is always the same and 
> doesn't even come close to the ttl value stored in the recent list.

Yeah, that's an old bug from when I switched to using hash tables
apparently.  I believe that *should* read:
while(hash_table[hash_result] != -1 && !(r_list[hash_table[hash_result]].addr == addr &&
	(!r_list[hash_table[hash_result]].ttl || r_list[hash_table[hash_result]].ttl != ttl))) {

Instead.  Note that I also had to invert the ttl check, it should be
considered a collision when the ttl doesn't match and matching ttl has
been requested.

> I got pretty fussed up patching and re-patching my kernel and your latest 
> release still didn't fix the --rttl problem.  Finally I spend quite some 
> time reviewing your source code.  Your code on the IPT_RECENT_TTL section 
> doesn't do a single thing because the location variable in r_list[location] 
> doesn't change when hash_result is incremented.  I tried adding location = 
> hash_table[hash_result] in the while loop, but that caused kernel panic.  I 
> rewrote the whole IPT_RECENT_TTL code and now my tests for TTL matching 
> works.  I fixed it!

Unfortunately what you did doesn't really work.  The goal of doing the
TTL match is to differentiate between IP addresses based on their TTL so
that they are really considered two seperate entities.  What you've done
is to only allow one TTL value per IP address, whichever TTL came first.
So, for example:

10.10.0.1 sends to router, TTL == 32
  10.10.0.1 gets added to recent list with ttl == 32
10.10.0.1 sends to router, TTL == 25
  10.10.0.1 gets 'found' in the hash table but then fails the TTL match

10.10.0.1 with TTL of 25 will therefore never make it into the recent
list, which is wrong.  Instead of just picking the first TTL and going
with that these two need to be treated seperately as if they were two
different IP addresses.

If you could try the above changes I'd like to hear if they work for you
or not.  I'll try and find some time to really test the TTL code soon.

> Also I fixed the (unreported) problem with ttl not being set zero when 
> manually adding ip addresses into the recent list with a for loop in a bash 

Thanks, added that into my local version.

	Stephen

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-03-03 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 13:20 ipt_recent 0.3.0 --rttl still doesn't work (I made a patch instead, can't wait) per j
2003-03-03 16:24 ` Stephen Frost [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-03 22:01 per j
2003-03-04  0:48 ` Stephen Frost
2003-03-03 22:14 per j
2003-03-04  0:49 ` Stephen Frost

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=20030303162454.GN2721@ns.snowman.net \
    --to=sfrost@snowman.net \
    --cc=ipt_recent@snowman.net \
    --cc=netfilter@lists.netfilter.org \
    --cc=perj8@hotmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox