diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-08-02 17:35:49 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-08-02 17:35:49 +0200 |
commit | 2452a99dc0496a90abd0090c280671370c0f3e1c (patch) | |
tree | 695cfb4bff794c4815f8d55e89426107ad3699de /net/ipv4/netfilter/nf_nat_proto_gre.c | |
parent | f43dc98b3be36551143e3bbaf1bb3067835c24f4 (diff) | |
download | linux-2452a99dc0496a90abd0090c280671370c0f3e1c.tar.gz linux-2452a99dc0496a90abd0090c280671370c0f3e1c.tar.bz2 linux-2452a99dc0496a90abd0090c280671370c0f3e1c.zip |
netfilter: nf_nat: don't check if the tuple is unique when there isn't any other choice
The tuple got from unique_tuple() doesn't need to be really unique, so the
check for the unique tuple isn't necessary, when there isn't any other
choice. Eliminating the unnecessary nf_nat_used_tuple() can save some CPU
cycles too.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4/netfilter/nf_nat_proto_gre.c')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_gre.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c b/net/ipv4/netfilter/nf_nat_proto_gre.c index 89933ab6f63e..bc8d83a31c73 100644 --- a/net/ipv4/netfilter/nf_nat_proto_gre.c +++ b/net/ipv4/netfilter/nf_nat_proto_gre.c @@ -68,9 +68,9 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, pr_debug("min = %u, range_size = %u\n", min, range_size); - for (i = 0; i < range_size; i++, key++) { + for (i = 0; ; ++key) { *keyptr = htons(min + key % range_size); - if (!nf_nat_used_tuple(tuple, ct)) + if (++i == range_size || !nf_nat_used_tuple(tuple, ct)) return; } |