Re: [PATCH] net: Remove a noisy printk

From: Jozsef Kadlecsik
Date: Sun Dec 14 2008 - 15:15:44 EST


On Sun, 14 Dec 2008, Jan Engelhardt wrote:

> On Sunday 2008-12-14 18:09, Jozsef Kadlecsik wrote:
> >>
> >> >> @@ -147,8 +147,6 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum,
> >> >> /* root is playing with raw sockets. */
> >> >> if (skb->len < sizeof(struct iphdr) ||
> >> >> ip_hdrlen(skb) < sizeof(struct iphdr)) {
> >> >> - if (net_ratelimit())
> >> >> - printk("ipt_hook: happy cracking.\n");
> >> >> return NF_ACCEPT;
> >> >> }
> >> >> return nf_conntrack_in(dev_net(out), PF_INET, hooknum, skb);
> >>
> >> I think this change is ok.
> >
> >In a >normal< system one usually does not use raw sockets. So if a root
> >process do use raw socket, at least netfilter sends a notification and
> >there's a chance that someone take notice it by checking the kernel logs.
> >[...]
> >But should we remove them due to nuisances on >test< systems?
> >
> >Rather make it a kernel compile option but do not remove.
>
> This warning is in the conntrack calling code. Iff you play with
> raw sockets and do something wrong, the generic network code
> should barf IMHO, not nf_conntrack, and not [nf_conntrack_ipv4 only].

It is not about doing something wrong at using raw sockets - it's about
using raw sockets.

I'm not quite convinced the generic network code should warn about raw
sockets. I believe it belongs to the security-related subsystems -
netfilter and (or) the security frameworks. [But as netfilter is much more
widely used, the 'or' is just theoretical.)

But back to netfilter: this is more than strange. The logging is already
removed from iptable_filter|mangle.c - and left in
ip6table_filter|mangle.c. The only place in the IPv4 path where the
checking happens is in nf_conntrack_l3proto_ipv4.c. IPv6 conntrack does
it as well, but uses another message text:

if (skb->len < sizeof(struct ipv6hdr)) {
if (net_ratelimit())
printk("ipv6_conntrack_local: packet too short\n");

[ISIC should check IPv6 too ;-).]

Best regards,
Jozsef
-
E-mail : kadlec@xxxxxxxxxxxxxxxxx, kadlec@xxxxxxxxxxxx
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/