Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Patrick McHardy <kaber@trash.net>,
	Netfilter Development Mailinglist
	<netfilter-devel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH iptables] extension: add xt_cpu match
Date: Fri, 23 Jul 2010 19:30:19 +0200	[thread overview]
Message-ID: <1279906219.2481.94.camel@edumazet-laptop> (raw)
In-Reply-To: <alpine.LSU.2.01.1007231841500.2880@obet.zrqbmnf.qr>

Le vendredi 23 juillet 2010 à 18:46 +0200, Jan Engelhardt a écrit :
> On Friday 2010-07-23 15:43, Eric Dumazet wrote:
> >+
> >+static const struct option cpu_opts[] = {
> >+	{ "cpu", 1, NULL, '1' },
> >+	{ .name = NULL }
> >+};
> 
> I will never understand that sort of style mix logic. Why the
> C99 initializer only on the sentinel?
> 
> {
> 	{.name = "cpu", .has_arg = true, .val = '1'},
> 	{NULL},
> };
> 

copy/paste from another module ?

> >+cpu_print(const void *ip, const struct xt_entry_match *match, int numeric)
> >+{
> >+	const struct xt_cpu_info *info = (void *)match->data;
> >+
> >+	printf("cpu %s%u ", info->invert ? "! ":"", info->cpu);
> >+}
> >+
> >+static void cpu_save(const void *ip, const struct xt_entry_match *match)
> >+{
> >+	const struct xt_cpu_info *info = (void *)match->data;
> >+
> >+	printf("%s--cpu %u ", info->invert ? "! ":"", info->cpu);
> >+}
> 
> Using if (info->invert) would save the empty string.
> 

Not sure what you mean. You want to save an empty string (1 byte long),
and add multiple printf() calls ?

> >diff --git a/extensions/libxt_cpu.man b/extensions/libxt_cpu.man
> >index e69de29..f42ac7a 100644
> >--- a/extensions/libxt_cpu.man
> >+++ b/extensions/libxt_cpu.man
> >@@ -0,0 +1,16 @@
> >+.TP
> >+[\fB!\fP] \fB\-\-cpu\fP \fInumber\fP
> >+
> >+Match cpu handling this packet. cpus are numbered from 0 to NR_CPUS-1
> 
> Unwanted blank line.
> 
> >+Can be used in combination with RPS (Remote Packet Steering) or
> >+multiqueue NICS to spread network traffic on different queues.
> >+.PP
> >+Example:
> >+.PP
> >+iptables \-t nat \-A PREROUTING \-p tcp \-\-dport 80 \-m cpu \-\-cpu 0 
> >+        \-j REDIRECT \-\-to\-port 8080
> 
> Unwanted indent.
> 
> >+.PP
> >+iptables \-t nat \-A PREROUTING \-p tcp \-\-dport 80 \-m cpu \-\-cpu 1 
> >+        \-j REDIRECT \-\-to\-port 8081
> >+.PP
> >+Available since linux 2.6.36
> 
> Linux.


OK ;)

I'll provide a cleanup patch, not only to xt_cpu but all other iptables
modules that dont meet your coding style requirements ;)

Thanks


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-07-23 17:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 14:03 [PATCH nf-next-2.6] netfilter: add xt_cpu match Eric Dumazet
2010-07-22 14:19 ` Jan Engelhardt
2010-07-22 15:18   ` Eric Dumazet
2010-07-22 15:39     ` Jan Engelhardt
2010-07-22 16:24       ` Eric Dumazet
2010-07-23 11:00     ` Patrick McHardy
2010-07-23 13:43       ` [PATCH iptables] extension: " Eric Dumazet
2010-07-23 14:13         ` Patrick McHardy
2010-07-23 16:46         ` Jan Engelhardt
2010-07-23 17:30           ` Eric Dumazet [this message]
2010-07-23 17:53             ` 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=1279906219.2481.94.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox