aboutsummaryrefslogtreecommitdiffstats
path: root/util/ip.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-09 20:56:37 +0100
committerKim Alvefur <zash@zash.se>2017-12-09 20:56:37 +0100
commiteab319deaf68a2489296153dd53cb4ff44db0060 (patch)
tree51cf8f3892a7dabaeeec7ca209304513f39af7e5 /util/ip.lua
parent9709fe286b042b5c4172ec84d3a87282b23e85dd (diff)
downloadprosody-eab319deaf68a2489296153dd53cb4ff44db0060.tar.gz
prosody-eab319deaf68a2489296153dd53cb4ff44db0060.zip
util.ip: Remove redundant caching of method output (supposed to be done in ab9ddfb03d4d but lost somehow)
Diffstat (limited to 'util/ip.lua')
-rw-r--r--util/ip.lua24
1 files changed, 7 insertions, 17 deletions
diff --git a/util/ip.lua b/util/ip.lua
index f4a933ea..0ec9e297 100644
--- a/util/ip.lua
+++ b/util/ip.lua
@@ -172,36 +172,27 @@ function ip_methods:toV4mapped()
end
function ip_methods:label()
- local value;
if self.proto == "IPv4" then
- value = label(self.toV4mapped);
+ return label(self.toV4mapped);
else
- value = label(self);
+ return label(self);
end
- self.label = value;
- return value;
end
function ip_methods:precedence()
- local value;
if self.proto == "IPv4" then
- value = precedence(self.toV4mapped);
+ return precedence(self.toV4mapped);
else
- value = precedence(self);
+ return precedence(self);
end
- self.precedence = value;
- return value;
end
function ip_methods:scope()
- local value;
if self.proto == "IPv4" then
- value = v4scope(self);
+ return v4scope(self);
else
- value = v6scope(self);
+ return v6scope(self);
end
- self.scope = value;
- return value;
end
local rfc1918_8 = new_ip("10.0.0.0");
@@ -212,9 +203,8 @@ local rfc6598 = new_ip("100.64.0.0");
function ip_methods:private()
local private = self.scope ~= 0xE;
if not private and self.proto == "IPv4" then
- private = match(self, rfc1918_8, 8) or match(self, rfc1918_12, 12) or match(self, rfc1918_16) or match(self, rfc6598, 10);
+ return match(self, rfc1918_8, 8) or match(self, rfc1918_12, 12) or match(self, rfc1918_16) or match(self, rfc6598, 10);
end
- self.private = private;
return private;
end