All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/4] netfilter: xtables: compact table hook functions (2/2)
Date: Wed, 10 Feb 2010 16:24:30 +0100	[thread overview]
Message-ID: <4B72CFAE.70601@trash.net> (raw)
In-Reply-To: <1265813954-13854-3-git-send-email-jengelh@medozas.de>

Jan Engelhardt wrote:
> diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
> index b320208..7f64ea5 100644
> --- a/net/ipv4/netfilter/iptable_filter.c
> +++ b/net/ipv4/netfilter/iptable_filter.c
> @@ -67,19 +67,15 @@ iptable_filter_hook(unsigned int hook,
>  	 const struct net_device *out,
>  	 int (*okfn)(struct sk_buff *))
>  {
> -	if (hook == NF_INET_LOCAL_OUT) {
> -		if (skb->len < sizeof(struct iphdr) ||
> -		    ip_hdrlen(skb) < sizeof(struct iphdr))
> -			/* root is playing with raw sockets. */
> -			return NF_ACCEPT;
> -
> -		return ipt_do_table(skb, hook, in, out,
> -				    dev_net(out)->ipv4.iptable_filter);
> -	}
> +	const struct net *net;
> +
> +	if (hook == NF_INET_LOCAL_OUT && (skb->len < sizeof(struct iphdr) ||
> +	    ip_hdrlen(skb) < sizeof(struct iphdr)))

This also looks strange. The length tests belong together, so this would
make it much more readable:

	if (hook == NF_INET_LOCAL_OUT &&
	    (skb->len < sizeof(struct iphdr) ||
	     ip_hdrlen(skb) < sizeof(struct iphdr)))
		...

Please also fix up similar cases in case there are any.

  reply	other threads:[~2010-02-10 15:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 14:59 static data reduction, 2010-02-10 Jan Engelhardt
2010-02-10 14:59 ` [PATCH 1/4] netfilter: xtables: compact table hook functions (1/2) Jan Engelhardt
2010-02-10 15:22   ` Patrick McHardy
2010-02-10 15:32     ` Jan Engelhardt
2010-02-10 14:59 ` [PATCH 2/4] netfilter: xtables: compact table hook functions (2/2) Jan Engelhardt
2010-02-10 15:24   ` Patrick McHardy [this message]
2010-02-10 14:59 ` [PATCH 3/4] netfilter: xtables: use xt_table for hook instantiation Jan Engelhardt
2010-02-10 15:27   ` Patrick McHardy
2010-02-10 16:05     ` Jan Engelhardt
2010-02-10 16:10       ` Patrick McHardy
2010-02-10 19:26         ` Jozsef Kadlecsik
2010-02-10 19:43           ` Jan Engelhardt
2010-02-10 19:46             ` Patrick McHardy
2010-02-10 20:09               ` Jan Engelhardt
2010-02-10 21:32             ` Jozsef Kadlecsik
2010-02-10 22:07               ` Jan Engelhardt
2010-02-10 22:10                 ` Jan Engelhardt
2010-02-10 15:33   ` Patrick McHardy
2010-02-10 16:07     ` Jan Engelhardt
2010-02-10 14:59 ` [PATCH 4/4] netfilter: xtables: generate initial table on-demand Jan Engelhardt
2010-02-10 15:32   ` Patrick McHardy
2010-02-10 16:21     ` Jan Engelhardt
2010-02-10 16:25       ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2010-02-10 16:51 static data reduction Jan Engelhardt
2010-02-10 16:51 ` [PATCH 2/4] netfilter: xtables: compact table hook functions (2/2) Jan Engelhardt
2010-02-07 11:49 Stomping Static Data pull, 2010-02-07 Jan Engelhardt
2010-02-07 11:49 ` [PATCH 2/4] netfilter: xtables: compact table hook functions (2/2) Jan Engelhardt
2009-10-10  9:22 stomping static data pull Jan Engelhardt
2009-10-10  9:22 ` [PATCH 2/4] netfilter: xtables: compact table hook functions (2/2) Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B72CFAE.70601@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.