Skip to contentSkip to conversation

netfilter-devel digest, Vol 1 #309 - 6 msgs

DISCUSSION zeinali 1 participant 1 message Feb 2, 2003 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20030201232700.1610.36555.Mailman@kashyyyk

zeinali

author
#1 lore raw

help

Many Thanks & Best Regards
Behnam Zeinali
www.maadiran.com

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: 2003/02/02 02:57 ?.?
To: [email protected]
Subject: netfilter-devel digest, Vol 1 #309 - 6 msgs

Send netfilter-devel mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.netfilter.org/mailman/listinfo/netfilter-devel
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of netfilter-devel digest..."

Today's Topics:

1. Re: iptables u32 match patch-o-matic (attempt) (Laszlo Valko)
2. Re: conntrack hash function comparison (Don Cohen)
3. Re: conntrack hash function comparison (Patrick Schaaf)
4. Re: conntrack hash function comparison (Don Cohen)
5. Re: conntrack hash function comparison (Harald Welte)
6. Re: conntrack hash function comparison (Don Cohen)

--__--__--

Message: 1
Date: Sat, 1 Feb 2003 01:23:05 +0100
From: Laszlo Valko <[email protected]>
To: Harald Welte <[email protected]>
Cc: Don Cohen <[email protected]>, [email protected]
Subject: Re: iptables u32 match patch-o-matic (attempt)

Quoted 12 lines · Harald Welte

On Wed, Jan 29, 2003 at 07:28:57AM -0800, Don Cohen wrote:
I also disagree with Laszlo. We don't need cross-architecture compatibility of those structures anyway.

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +7 -0
+struct ipt_u32_test
+{
+	u_int8_t nnums;
+	struct ipt_u32_location_element location[U32MAXSIZE+1];
+	u_int8_t nvalues;
+	struct ipt_u32_value_element value[U32MAXSIZE+1];
+};
Quoted 5 lines
Quoted 3 lines

In this one case at least it might help to put the two 8's together,

right?

yes, it should. depending on compiler and archtiecture, though.

Ok, but please understand that gcc will not do any packing on x86 or any RISC platforms by default. And since this is part of the platform ABI, the default behaviour is a fairly stable thing. This boils down to saying that whatever you use (u_int8_t or u_int32_t), it will not matter, the compiler will generate the same structure for all major platforms of Linux (x86, alpha, sparc for sure).

Of course, this whole debate is akin to splitting a hair into two... :)

Regards,
Laszlo

Quoted 3 lines

--
Live long and prosper
- Harald Welte / [email protected]

http://www.gnumonks.org/

Quoted 1 line

========================================================================
====

Quoted 1 line

GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O-

M-

Quoted 1 line

V-- PS+ PE-- Y+ PGP++ t++ 5-- !X !R tv-- b+++ DI? !D G+ e* h+ r% y+(*)

--__--__--

Message: 2
From: [email protected] (Don Cohen)
Date: Fri, 31 Jan 2003 16:41:28 -0800
To: Harald Welte <[email protected]>
Cc: Jozsef Kadlecsik <[email protected]>,
[email protected]
Subject: Re: conntrack hash function comparison

Quoted 1 line · Harald Welte

not that I totally disagree with rehashing being a good idea... but

in

Quoted 3 lines

the case you add this 'small piece of code', you also introduce a new
vulnerability: If somebody can provoke the firewall to rehash all the time ;(

The counter argument is that if they can do that then they have a way of causing lots of connections to go into the same bucket, and allowing that to happen is (at least in the extreme case) much worse than rehashing. Obviously it's also bad to rehash too eagerly.
I think the only question is where to put the threshold.

It's reasonable to make that threshold read/writable via /proc.

--__--__--

Message: 3
Date: Sat, 1 Feb 2003 07:57:01 +0100
From: Patrick Schaaf <[email protected]>
To: Don Cohen <[email protected]>
Cc: Harald Welte <[email protected]>,
Jozsef Kadlecsik <[email protected]>,
[email protected]
Subject: Re: conntrack hash function comparison

Quoted 2 lines · Don Cohen
Quoted 1 line · Harald Welte

not that I totally disagree with rehashing being a good idea... but

in

Quoted 1 line
Quoted 1 line

the case you add this 'small piece of code', you also introduce a

new

Quoted 1 line
Quoted 1 line

vulnerability: If somebody can provoke the firewall to rehash all

the

Quoted 3 lines
Quoted 1 line

time ;(

The counter argument is that if they can do that then they have a way of causing lots of connections to go into the same bucket, and

allowing

Quoted 3 lines

that to happen is (at least in the extreme case) much worse than rehashing. Obviously it's also bad to rehash too eagerly. I think the only question is where to put the threshold.

I imagine that instead of, or in addition to, a threshold on list lengths, I would like to have a "minimum time between rehashings" knob, set to e.g. one hour. That way, the cost is guaranteed independant of packet arrival rate. And, to practically disable rehashing, that knob can be set to an immensely large value.

Hmm. Maybe even with a printk() 10 (N) minutes in advance, telling the admin "I think I'm going to rehash a bit, soon".

No. Forget about all that.

1) metrics in /proc, including a "max list length during the last hour" statistic.
2) one read/writable /proc entry, containing an integer: the number of hash buckets. This is missing right now, anyway (have to grep the boot messages). Make it writable, and rehash exactly when a write changes the hash bucket count.

This way, the policy (when to rehash) is safely in user space, the kernel gives mechanism, only - just like it should.

What do you think?

best regards
Patrick

--__--__--

Message: 4
From: [email protected] (Don Cohen)
Date: Fri, 31 Jan 2003 23:58:37 -0800
To: Patrick Schaaf <[email protected]>
Cc: Harald Welte <[email protected]>,
Jozsef Kadlecsik <[email protected]>,
[email protected]
Subject: Re: conntrack hash function comparison

Quoted 3 lines · Patrick Schaaf
Quoted 2 lines · Don Cohen
Quoted 1 line · Harald Welte

not that I totally disagree with rehashing being a good idea...

but in

Quoted 1 line
Quoted 1 line
Quoted 1 line

the case you add this 'small piece of code', you also introduce

a new

Quoted 1 line
Quoted 1 line
Quoted 1 line

vulnerability: If somebody can provoke the firewall to rehash

all the

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

time ;(

The counter argument is that if they can do that then they have a

way

Quoted 1 line
Quoted 1 line

of causing lots of connections to go into the same bucket, and

allowing

Quoted 6 lines
Quoted 3 lines

that to happen is (at least in the extreme case) much worse than rehashing. Obviously it's also bad to rehash too eagerly. I think the only question is where to put the threshold.

I imagine that instead of, or in addition to, a threshold on list lengths, I would like to have a "minimum time between rehashings"

knob,

Quoted 3 lines

set to e.g. one hour. That way, the cost is guaranteed independant of packet arrival rate. And, to practically disable rehashing, that knob can be set to an immensely large value.

I don't understand the utility of such a control. Why should you rehash if the table is doing ok? Conversely, if it's not, why should you suffer for an hour?

Quoted 1 line

1) metrics in /proc, including a "max list length during the last

hour"

Quoted 1 line

statistic.

not very practical if you think about it
More reasonable: longest bucket length since last rehash
If you really want to take the time to look at such things, I'd suggest a list of lengths of all buckets.

Quoted 1 line

2) one read/writable /proc entry, containing an integer: the number

of

Quoted 3 lines

hash buckets. This is missing right now, anyway (have to grep the boot messages). Make it writable, and rehash exactly when a write changes the hash bucket count.

It's currently a module parameter? Not that it would be so hard to change it at run time, but is that really so useful?
You could unload the module and reload it with a different parameter. If the complaint is that you then lose the data, I suggest using the proc file to save and restore (copy the /proc data to a real file, then copy it back after unload/reload). That would even let you save and restore over a reboot.

Quoted 2 lines

This way, the policy (when to rehash) is safely in user space, the kernel gives mechanism, only - just like it should.

/proc control over the rehash threshold (max bucket size) seems like an appropriate "control over policy".
Whereas a user space program doing something to cause a rehash seems to me to be a bad choice. (For one thing, when the kernel gets into trouble the user space program might never have a chance to run.)

--__--__--

Message: 5
Date: Sat, 1 Feb 2003 09:37:03 +0100
From: Harald Welte <[email protected]>
To: Don Cohen <[email protected]>
Cc: Patrick Schaaf <[email protected]>,
Jozsef Kadlecsik <[email protected]>, [email protected]
Subject: Re: conntrack hash function comparison

--K6Vt3zCKtaqyTnPU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Quoted 3 lines · Don Cohen

not very practical if you think about it
More reasonable: longest bucket length since last rehash If you really want to take the time to look at such things, I'd

suggest

Quoted 1 line

a list of lengths of all buckets.

I think that whas what Jozsef really meant.

Quoted 1 line
Quoted 1 line

2) one read/writable /proc entry, containing an integer: the number

of

Quoted 1 line
Quoted 1 line

hash buckets. This is missing right now, anyway (have to grep

the

Quoted 1 line
Quoted 1 line

boot messages). Make it writable, and rehash exactly when a

write

Quoted 2 lines
Quoted 1 line

changes the hash bucket count.

It's currently a module parameter? =20

yes, it is. =20

Quoted 2 lines

Not that it would be so hard to
change it at run time, but is that really so useful?

Especially in the case where it is not a kernel module ;)

Quoted 1 line

You could unload the module and reload it with a different parameter.

=20

Quoted 2 lines

If the complaint is that you then lose the data, I suggest using the proc file to save and restore (copy the /proc data to a real file,

then

Quoted 1 line

copy it back after unload/reload). That would even let you save

and=20

Quoted 1 line

restore over a reboot.

no way. no way. no way.
sorry, but read the various discussions about the /proc/ip_conntrack interface in general, think about all the data that is not printed (like references to currently in-kernel packets, connection between expectations and master connection, ... lots of those issues are relevant for conntrack failover as well. This is only viable via ctnetlink, which is not part of the stock kernel yet.

Quoted 6 lines
Quoted 2 lines

This way, the policy (when to rehash) is safely in user space, the kernel gives mechanism, only - just like it should.

/proc control over the rehash threshold (max bucket size) seems like an appropriate "control over policy". =20
Whereas a user space program doing something to cause a rehash seems to me to be a bad choice. (For one thing, when the kernel gets

into=20

Quoted 1 line

trouble the user space program might never have a chance to run.)

yes, I agree. and that's why i like the idea of a 'min rehash interval' proc parameter. If you set this to '0', kernel will rehash never. '1' means maximum of one rehash per second, ...

--=20
- Harald Welte / [email protected]
http://www.gnumonks.org/
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=
=3D
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
as I'm the dictator." -- George W. Bush Dec 18, 2000

--K6Vt3zCKtaqyTnPU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+O4cvXaXGVTD0i/8RAhvxAJoCl7Sdjn0Ow14tP+wpRbaeR3FL5wCgipnO wOOtExlsljk8DjVj9J7xQW4=
=JxKS
-----END PGP SIGNATURE-----

--K6Vt3zCKtaqyTnPU--

--__--__--

Message: 6
From: [email protected] (Don Cohen)
Date: Sat, 1 Feb 2003 11:05:54 -0800
To: Harald Welte <[email protected]>
Cc: Patrick Schaaf <[email protected]>, Jozsef Kadlecsik
<[email protected]>,
[email protected]
Subject: Re: conntrack hash function comparison

Quoted 1 line · Harald Welte
Quoted 1 line

Not that it would be so hard to change [hash table size]

at run time, but is that really so useful?

Quoted 1 line

Especially in the case where it is not a kernel module ;)

Well, then you need a way to initialize it. Is there a standard solution to this problem? Or is the inability to choose such values just the penalty you pay for choosing Y instead of M?

Quoted 1 line
Quoted 1 line

You could unload the module and reload it with a different

parameter.

Quoted 1 line
Quoted 1 line

If the complaint is that you then lose the data, I suggest using

the

Quoted 1 line
Quoted 1 line

proc file to save and restore (copy the /proc data to a real file,

then

Quoted 1 line
Quoted 1 line

copy it back after unload/reload). That would even let you save

and

Quoted 5 lines
Quoted 1 line

restore over a reboot.

no way. no way. no way.
sorry, but read the various discussions about the /proc/ip_conntrack interface in general, think about all the data that is not printed

(like

Quoted 4 lines

references to currently in-kernel packets, connection between expectations and master connection, ... lots of those issues are relevant for conntrack failover as well. This is only viable via ctnetlink, which is not part of the stock kernel yet.

This was meant as a general suggestion, not specific to conntrack.

I don't know all the details specific to conntrack. It seems surprising that you couldn't save all relevant state via /proc. Even more so if you think you could do it with netlink. The stuff above suggests that you're worried about highly volatile state, but the suggestion is meant only for "stable" states. It makes sense to remember connections across a reboot (if it doesn't take too long), not packets. You'd have to effectively disable networking (so there are no packets to save) before saving state.

I plan to try it for my module that does conntrack-like things.

Quoted 1 line
Quoted 1 line
Quoted 1 line

This way, the policy (when to rehash) is safely in user space,

the

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

kernel gives mechanism, only - just like it should.

/proc control over the rehash threshold (max bucket size) seems

like

Quoted 2 lines
Quoted 2 lines

an appropriate "control over policy".
Whereas a user space program doing something to cause a rehash

seems

Quoted 1 line
Quoted 1 line

to me to be a bad choice. (For one thing, when the kernel gets

into

Quoted 3 lines
Quoted 1 line

trouble the user space program might never have a chance to run.)

yes, I agree. and that's why i like the idea of a 'min rehash

interval'

Quoted 1 line

proc parameter. If you set this to '0', kernel will rehash never.

'1'

Quoted 1 line

means maximum of one rehash per second, ...

I think I finally understand what this is all about. It's not to automatically rehash after time t, but rather to make sure you don't spend all of your time rehashing. This seems reasonable.

--__--__--

_______________________________________________
netfilter-devel mailing list
[email protected]
https://lists.netfilter.org/mailman/listinfo/netfilter-devel

End of netfilter-devel Digest