From: "Changli Gao" <xiaosuo@gmail.com>
To: "Patrick McHardy" <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
Date: Tue, 8 Jul 2008 10:50:59 +0800 [thread overview]
Message-ID: <412e6f7f0807071950r1d64ad4dn1fd1cc3065e27a5c@mail.gmail.com> (raw)
In-Reply-To: <4871FCFE.1020202@trash.net>
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
The attachment is the patch.
On Mon, Jul 7, 2008 at 7:24 PM, Patrick McHardy <kaber@trash.net> wrote:
> Changli Gao wrote:
>>
>> On Mon, Jun 30, 2008 at 8:54 PM, Patrick McHardy <kaber@trash.net> wrote:
>>>
>>> Changli Gao wrote:
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Changli Gao <xiaosuo@gmail.com>
>>>> Date: 2008/6/30
>>>> Subject: [PATCH] nf_nat_core: eliminate find_appropriate_src call if
>>>> range is set IP_NAT_RANGE_PROTO_RANDOM bit on
>>>> To: netfilter-devel@lists.netfilter.org
>>>> Cc: Changli Gao <xiaosuo@gmail.com>
>>>>
>>>>
>>>> Eliminate find_appropriate_src call if range is set
>>>> IP_NAT_RANGE_PROTO_RANDOM bit on.
>>>
>>> Please explain why the call isn't necessary.
>>>
>> In fact, my patch doesn't change the logic of the code, it just
>> eliminates the uesless call find_appropriate_src. Because the tuple
>> returned by find_appropriate is only useful when the
>> IP_NAT_RANGE_PROTO_RANDOM isn't set on. instead of testing the bit
>> IP_NAT_RANGE_PROTO_RANDOM after calling find_appropriate_src, I do
>> that before it to eliminate the cost of calling find_appropriate_src.
>
> OK, but it does not apply cleanly because of whitespace mangling.
> Please resend as attachment.
>
--
Regards,
Changli Gao(xiaosuo@gmail.com)
[-- Attachment #2: nf_nat_core_opt.diff --]
[-- Type: application/octet-stream, Size: 754 bytes --]
--- linux/net/ipv4/netfilter/nf_nat_core.c 2008-06-30 11:12:26.000000000 +0800
+++ linux-new/net/ipv4/netfilter/nf_nat_core.c 2008-06-30 12:22:23.000000000 +0800
@@ -240,12 +240,12 @@
This is only required for source (ie. NAT/masq) mappings.
So far, we don't do local source mappings, so multiple
manips not an issue. */
- if (maniptype == IP_NAT_MANIP_SRC) {
+ if (maniptype == IP_NAT_MANIP_SRC &&
+ !(range->flags & IP_NAT_RANGE_PROTO_RANDOM)) {
if (find_appropriate_src(orig_tuple, tuple, range)) {
pr_debug("get_unique_tuple: Found current src map\n");
- if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM))
- if (!nf_nat_used_tuple(tuple, ct))
- return;
+ if (!nf_nat_used_tuple(tuple, ct))
+ return;
}
}
next prev parent reply other threads:[~2008-07-08 2:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <412e6f7f0806292132l18c747d6h982c64ce7c9d9c85@mail.gmail.com>
2008-06-30 8:00 ` Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on Changli Gao
2008-06-30 12:54 ` Patrick McHardy
2008-06-30 13:34 ` Changli Gao
2008-07-07 11:24 ` Patrick McHardy
2008-07-08 2:50 ` Changli Gao [this message]
2008-07-09 16:54 ` Patrick McHardy
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=412e6f7f0807071950r1d64ad4dn1fd1cc3065e27a5c@mail.gmail.com \
--to=xiaosuo@gmail.com \
--cc=kaber@trash.net \
--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