[PATCH] new random match

Fabrice MARIE fabrice@celestix.com
Sun, 14 Oct 2001 16:23:30 +0800


--------------Boundary-00=_6NS6O4E9B5NPEX3D1NCS
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Sunday 14 October 2001 06:13, Jan Srzednicki wrote:
> Hello,
> I miss one feature that I have in FreeBSD's ipfw: probability match. I
> think such a module would be very simple (well, except for the part of
> choosing apropriate PRNG - I think Mersenne Twister would be the best
> choice). It could work like this:
> iptables -A something -m random --random-match X -j something
> [...]

Hello,

As promised, attached is the 'ramdom' match patch
to the current patch-o-matic CVS tree.

It allows you to match a packet randomly with
the given probability, 50% by default.

It's working fine for me, and it's easily testable :

let's say we want to drop 25% of pings, simply use

# iptables -A INPUT -p icmp --icmp-type echo-request \
  -d 127.0.0.1 -m random --average 25 -j DROP

# ping -f -c 5000 127.0.0.1
PING 127.0.0.1 (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.
..................................................................
..................................................................
..................................................................
..................................................................
..................................................................
[... lots of dots..]
--- 127.0.0.1 ping statistics ---
6765 packets transmitted, 5000 packets received, 26% packet loss
round-trip min/avg/max/mdev = 0.026/0.255/2.200/0.426 ms

btw, it's using linux standard random routine which
is definitely good enough for that I believe :)

Hope this helps,

Have a nice day,

Fabrice.
--
Fabrice MARIE
Senior R&D Engineer
Celestix Networks
http://www.celestix.com/

"Silly hacker, root is for administrators" 
       -Unknown

--------------Boundary-00=_6NS6O4E9B5NPEX3D1NCS
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="random_match_patch.diff"
Content-Transfer-Encoding: base64
Content-Description: add a random patch in patch-o-matic to match packet randomly with the given probability
Content-Disposition: attachment; filename="random_match_patch.diff"

ZGlmZiAtdU5yIGN2cy9uZXRmaWx0ZXIvdXNlcnNwYWNlL01ha2VmaWxlIG5ldGZpbHRlci91c2Vy
c3BhY2UvTWFrZWZpbGUKLS0tIGN2cy9uZXRmaWx0ZXIvdXNlcnNwYWNlL01ha2VmaW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