* Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
[not found] <412e6f7f0806292132l18c747d6h982c64ce7c9d9c85@mail.gmail.com>
@ 2008-06-30 8:00 ` Changli Gao
2008-06-30 12:54 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Changli Gao @ 2008-06-30 8:00 UTC (permalink / raw)
To: netfilter-devel
---------- 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.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
nf_nat_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- net/ipv4/netfilter/nf_nat_core.c.orig 2008-06-30
11:12:26.000000000 +0800
+++ 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;
}
}
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
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
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2008-06-30 12:54 UTC (permalink / raw)
To: Changli Gao; +Cc: netfilter-devel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
2008-06-30 12:54 ` Patrick McHardy
@ 2008-06-30 13:34 ` Changli Gao
2008-07-07 11:24 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Changli Gao @ 2008-06-30 13:34 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
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.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
2008-06-30 13:34 ` Changli Gao
@ 2008-07-07 11:24 ` Patrick McHardy
2008-07-08 2:50 ` Changli Gao
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2008-07-07 11:24 UTC (permalink / raw)
To: Changli Gao; +Cc: netfilter-devel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
2008-07-07 11:24 ` Patrick McHardy
@ 2008-07-08 2:50 ` Changli Gao
2008-07-09 16:54 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Changli Gao @ 2008-07-08 2:50 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
[-- 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;
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: [PATCH] nf_nat_core: eliminate find_appropriate_src call if range is set IP_NAT_RANGE_PROTO_RANDOM bit on
2008-07-08 2:50 ` Changli Gao
@ 2008-07-09 16:54 ` Patrick McHardy
0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2008-07-09 16:54 UTC (permalink / raw)
To: Changli Gao; +Cc: netfilter-devel
Changli Gao wrote:
> The attachment is the patch.
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-07-09 16:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2008-07-09 16:54 ` Patrick McHardy
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.