All of lore.kernel.org
 help / color / mirror / Atom feed
* testing checksum in helpers is redundant with tcp_window_tracking
@ 2003-02-27 22:21 netfilter
  2003-02-28  9:04 ` Patrick Schaaf
  2003-02-28 10:33 ` Jozsef Kadlecsik
  0 siblings, 2 replies; 4+ messages in thread
From: netfilter @ 2003-02-27 22:21 UTC (permalink / raw)
  To: Netfilter Development Mailinglist

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

Would it not be a good idea to have some kind of macro defined when
tcp_window_tracking in built into netfilter so that all of the helpers
and other code that are doing things like TCP checksum verification
and whatnot, can avoid wasting cycles doing it a second time?

Then helpers could wrap their tcp checksum calls with something like:

#ifndef TCP_WINDOW_TRACKING
...
#endif

Or is a runtime check a better idea?  If so what test could be done at
runtime to know that tcp_window_tracking is checking TCP checksums?

b.

-- 
Brian J. Murrell

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: testing checksum in helpers is redundant with tcp_window_tracking
  2003-02-27 22:21 testing checksum in helpers is redundant with tcp_window_tracking netfilter
@ 2003-02-28  9:04 ` Patrick Schaaf
  2003-02-28 10:33 ` Jozsef Kadlecsik
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick Schaaf @ 2003-02-28  9:04 UTC (permalink / raw)
  To: Netfilter Development Mailinglist

> Then helpers could wrap their tcp checksum calls with something like:
> 
> #ifndef TCP_WINDOW_TRACKING
> ...
> #endif

Please don't do it that way. If you have to write the same ifdef several
times in several .c files, you are doing something wrong.

The good way is this:

- make all places call a single "check sum in conntrack helper" function.
- define that function as a 'static inline' in one of the existing .h files,
  where it logically fits. Make that definition dependant on the
  WINDOW_TRACKING define, providing a completely empty 'static inline'
  function when the window tracking compile option is set.

Done this way, the call sites are not uglified by ifdefs, and it's still
a compile-time go-away-code situation. This scheme is used in lots of
places in the kernel.

What happens with incremental modular compiles, and the user
flipping the WINDOW_TRACKING switch? i.e. some modules compiled one
way, and some compiled the other way?

For a possible other approach: isn't there some flag in the skbuff,
normally used by the local TCP stack, which can remember that a checksum
was done, and it was ok? I remember such things being introduced when
they started supporting hardware checksums, but I'm ignorant of any
detail. Could it be that the conntrack/helpers might just also use
that infrastructure?

best regards
  Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: testing checksum in helpers is redundant with tcp_window_tracking
  2003-02-27 22:21 testing checksum in helpers is redundant with tcp_window_tracking netfilter
  2003-02-28  9:04 ` Patrick Schaaf
@ 2003-02-28 10:33 ` Jozsef Kadlecsik
  2003-02-28 12:13   ` netfilter
  1 sibling, 1 reply; 4+ messages in thread
From: Jozsef Kadlecsik @ 2003-02-28 10:33 UTC (permalink / raw)
  To: netfilter; +Cc: Netfilter Development Mailinglist

On Thu, 27 Feb 2003 netfilter@interlinx.bc.ca wrote:

> Would it not be a good idea to have some kind of macro defined when
> tcp_window_tracking in built into netfilter so that all of the helpers
> and other code that are doing things like TCP checksum verification
> and whatnot, can avoid wasting cycles doing it a second time?
>
> Then helpers could wrap their tcp checksum calls with something like:
>
> #ifndef TCP_WINDOW_TRACKING
> ...
> #endif

No, I think that is a bad idea. The tcp-window-tracking patch patches the
default helpers (ftp, irc) and remove the redundant checkings. However the
current status of the patch is 'extra'. Not even 'base'. No other
subsystem/patch should be made dependent of it.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: testing checksum in helpers is redundant with tcp_window_tracking
  2003-02-28 10:33 ` Jozsef Kadlecsik
@ 2003-02-28 12:13   ` netfilter
  0 siblings, 0 replies; 4+ messages in thread
From: netfilter @ 2003-02-28 12:13 UTC (permalink / raw)
  To: Netfilter Development Mailinglist

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

On Fri, Feb 28, 2003 at 11:33:15AM +0100, Jozsef Kadlecsik wrote:
> 
> No, I think that is a bad idea. The tcp-window-tracking patch patches the
> default helpers (ftp, irc) and remove the redundant checkings.

Right.  I have noticed this.  But based on that idea, it should patch
all of the helpers, but that becomes a maintenance nightmare.

> However the
> current status of the patch is 'extra'.

Right.  I understand that.

> No other
> subsystem/patch should be made dependent of it.

If it were a requirement type of dependancy, I would completely agree
with you, but I am talking about an optional "take advantage of it if
it's there and business as usual if it's not" type dependency.

Adding a macro to tcp-window-tracking (simply signifying it's in the
kernel) and wrapping the tcp checks in helpers with a test for the
macro does not introduce any loss of functionality at all.  A module
writer doesn't even have to use it if he doesn't want to, but if he
wants his module to be as efficient as possible in the presence of
tcp-window-tracking, he can use the macro.

b.

-- 
Brian J. Murrell

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-28 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-27 22:21 testing checksum in helpers is redundant with tcp_window_tracking netfilter
2003-02-28  9:04 ` Patrick Schaaf
2003-02-28 10:33 ` Jozsef Kadlecsik
2003-02-28 12:13   ` netfilter

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.