From: Herve Eychenne Subject: Re: possible issues with blowing up struct ipt_log_info Date: Mon, 4 Jul 2005 11:23:59 +0200 Message-ID: <20050704092359.GB3331@eychenne.org> References: <42C2C053.3040707@tac.ch> <20050629154049.GA17717@oknodo.bof.de> <20050629160923.GF3331@eychenne.org> <20050703123650.GW3186@sunbeam.de.gnumonks.org> <20050703220525.GA3331@eychenne.org> <20050704055541.GA29624@oknodo.bof.de> Reply-To: rv@eychenne.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Harald Welte , Netfilter Developers Return-path: To: Patrick Schaaf Content-Disposition: inline In-Reply-To: <20050704055541.GA29624@oknodo.bof.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org On Mon, Jul 04, 2005 at 07:55:42AM +0200, Patrick Schaaf wrote: > > Trying to insert potentially many LOG rules to empirically determine > > the maximum prefix length is far less complex, that's for sure. ;-) > Do we already have indeterminate log prefix length? I thought we had > one, fixed size, no probing neccessary. Am I wrong? The max LOG prefix length is determined by the static length of the kernel structure. So this size has to be changed in the kernel source before compilation. That's rare, obviously. However, I already saw a few setups where this value had been changed by hand. So we have two options: - consider that those who do that should deal themselves with the consequences of their action - take as much cases as possible into account I guess many kernel guys here will vote for the first one. I'm more user-oriented ("should work in any case, if possible"). So that LOG length thing is not so bad here, but the philosophy behind it bothers me. Parallel: - static sizes are good - static sizes are to be avoided every time this is possible, especially for "human" entered/oriented data This leads to some Unix hall-of-shame relics like static command line length and co. > > For now, that's the only way an upper-level tool will produce valid > > LOG rules in all cases. > The way to produce valid log rules in all cases, is to keep this > fancy long long stuff in user level, and set pointer / index values > or whatever small token can be used, for a log prefix in the kernel. > Any scheme which probes the possible length, will also need some > fallback when kernel length is smaller than user desire. If your > goal is 'valid in all cases'. Right? Then you'll need such a > token/pointer approach anyway! You're right, but the token has a drawback: it's not readable by a human being. Ok, you'll say that the token has been generated by a higher-level application, so why not use another higher-level application to read the logs? I'll answer: yes, but then writing logs to syslog (human oriented, right?) becomes all the more irrelevant, and sometimes it's good not to require a special tool for simple tasks. For the first argument you'll point me to ULOG, and the second is a matter of taste (KISS or not KISS, that's the question). End of the discussion? ;-) The very same thing applies to chainname length. Imagine you split your ruleset into several "zone1-zone2 traffic" (zone1 to zone2) chains, which is wise for complex setups. Imagine you let the user choose zone names (fair enough). This limits the name of a zone to 14 chars (2*14<30). So it becomes almost practically impossible to permit zone names like word1_word2. You'll say: so don't do this. I'll say: why couldn't I if I want to? But this won't lead us anywhere, I fear. Maybe you'll even point me to the same token trick. But the ruleset (dumped by iptables-save, for example) will become really obfuscated, and all the more hard to understand for a human being (bad, IMHO) and to debug. > > Probably many of you won't care, but for this kind of upper-layers > > (which I'm particularly concerned with) netfilter/iptables sometimes > > makes it hard to turn "should work" into "will work". > > That LOG thing is only one example, though probably not the best. > Then maybe you could provide a better one? Are you ready to endure a really long discussion? ;-) There are plenty of them. That would require a whole separated thread and quite a lot of time (I somewhat lack it today). Probably I'll start several threads later about this. Be prepared... ;-) > > > I also don't really like using out-of-band interfaces such as /proc > > > to determine how to communicate rules via {get,set}sockopt() > > Maybe you don't like /proc, but the kernel still has to provide a way > > to inform userspace about the fixed size of some of its data (as > > kernelspace doesn't like dynamic things very much...). If you see a > > better way, that's ok, but the need is still there. > If getsockopt is good to communicate iptables rules and other stuff, > it must be good enough to also communicate 'length of X is Y'... So some values would be obtained via /proc, some via [sg]etsockopt. This lacks coherence... :-( I don't care that much about the way it can be obtained, except that with [sg]etsockopt, the user would need yet another tool to get the value... What's so wrong with /proc, BTW? Herve -- _ (°= Hervé Eychenne //) v_/_ WallFire project: http://www.wallfire.org/