Skip to content

Commit

Permalink
netfilter: ipt_LOG: add bufferisation to call printk() once
Browse files Browse the repository at this point in the history
ipt_LOG & ip6t_LOG use lot of calls to printk() and use a lock in a hope
several cpus wont mix their output in syslog.

printk() being very expensive [1], its better to call it once, on a
prebuilt and complete line. Also, with mixed IPv4 and IPv6 trafic,
separate IPv4/IPv6 locks dont avoid garbage.

I used an allocation of a 1024 bytes structure, sort of seq_printf() but
with a fixed size limit.
Use a static buffer if dynamic allocation failed.

Emit a once time alert if buffer size happens to be too short.

[1]: printk() has various features like printk_delay()...

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Eric Dumazet authored and Patrick McHardy committed Oct 4, 2010
1 parent 0c200d9 commit a8defca
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 150 deletions.
Loading

0 comments on commit a8defca

Please sign in to comment.