]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ipt_LOG: add bufferisation to call printk() once
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 4 Oct 2010 18:56:05 +0000 (20:56 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 4 Oct 2010 18:56:05 +0000 (20:56 +0200)
commitebcd6fb75996908bf8f4e4f3a3114e144681028f
treeb486460fd1f2310cd4572bd36c126a3fa8b3a5c5
parentaa4e6e891ba4e4d0883c5a224a426564c75bf618
netfilter: ipt_LOG: add bufferisation to call printk() once

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>
net/ipv4/netfilter/ipt_LOG.c
net/ipv6/netfilter/ip6t_LOG.c