linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Patrick McHardy <kaber@trash.net>
Cc: Wensong Zhang <wensong@linux-vs.org>,
	Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, lvs-devel <lvs-devel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/netfilter/ipvs/ip_vs_ftp.c: Remove use of NIPQUAD
Date: Mon, 15 Mar 2010 09:58:34 -0700	[thread overview]
Message-ID: <1268672314.4027.46.camel@Joe-Laptop.home> (raw)
In-Reply-To: <4B9E5E43.9060206@trash.net>

On Mon, 2010-03-15 at 17:20 +0100, Patrick McHardy wrote:
> Joe Perches wrote:
> > NIPQUAD has very few uses left.
> > Remove this use and make the code have the identical form of the only
> > other use of "%u,%u,%u,%u,%u,%u" in net/ipv4/netfilter/nf_nat_ftp.c
> 
> Are we trying to remove NIPQUAD? 

That is a goal for me yes.
Elimination of unnecessary stuff from kernel.h is useful.

> In my opinion the current code is
> preferrable to open-coding NIPQUAD.

$ grep -r --include=*.[ch] NIPQUAD *
include/linux/kernel.h:#define NIPQUAD(addr) \
include/linux/kernel.h:#define NIPQUAD_FMT "%u.%u.%u.%u"
net/netfilter/ipvs/ip_vs_ftp.c:		sprintf(buf, "%u,%u,%u,%u,%u,%u", NIPQUAD(from.ip),

As of right now NIPQUAD_FMT is unused and
could be removed from kernel.h

There's 1 use of NIPQUAD.

Maybe instead of removal the #define could be
moved to netfilter.h or netfilter_ipv4.h

Another is to consolidate the two uses of
"%u,%u,%u,%u,%u,%u"

$ grep -r --include=*.[ch] "%u,%u,%u,%u,%u,u%" *
fs/cachefiles/bind.c:	_enter("{%u,%u,%u,%u,%u,%u},%s",
net/ipv4/netfilter/nf_nat_ftp.c:		return snprintf(buffer, buflen, "%u,%u,%u,%u,%u,%u",
net/netfilter/ipvs/ip_vs_ftp.c:		sprintf(buf, "%u,%u,%u,%u,%u,%u", NIPQUAD(from.ip),

Maybe these 2 open coded sprintf/snprintf could be
consolidated and moved to an appropriate include
like netfilter_ipv4 or another.

What do you suggest?


  reply	other threads:[~2010-03-15 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09  0:31 [PATCH] net/netfilter/ipvs/ip_vs_ftp.c: Remove use of NIPQUAD Joe Perches
2010-03-09  4:08 ` Simon Horman
2010-03-15 16:20 ` Patrick McHardy
2010-03-15 16:58   ` Joe Perches [this message]
2010-03-15 17:04     ` Patrick McHardy
2010-03-15 19:01   ` David Miller

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=1268672314.4027.46.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wensong@linux-vs.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;
as well as URLs for NNTP newsgroup(s).