commit 9fe4c80: wrap ipv6-adresses in brackets

cgielen c.gielen at uvt.nl
Wed Aug 14 15:14:04 UTC 2019


Author: cgielen
Date: 2019-08-14 14:01:13 +0200
URL: https://github.com/rspamd/rspamd/commit/9fe4c804c1298586a727f820ff718ca3e1042af5 (refs/pull/3005/head)

wrap ipv6-adresses in brackets

---
 lualib/lua_redis.lua | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index f3ff6d400..27ac53478 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -92,6 +92,11 @@ local function redis_query_sentinel(ev_base, params, initialised)
     for _,m in ipairs(result) do
       local master = flatten_redis_table(m)
 
+      -- Wrap IPv6-adresses in brackets
+      if (master.ip:match(":")) then
+        master.ip = "["..master.ip.."]"
+      end
+
       if params.sentinel_masters_pattern then
         if master.name:match(params.sentinel_masters_pattern) then
           lutil.debugm(N, 'found master %s with ip %s and port %s',
@@ -122,6 +127,10 @@ local function redis_query_sentinel(ev_base, params, initialised)
           lutil.debugm(N, rspamd_config,
               'found slave form master %s with ip %s and port %s',
               v.name, slave.ip, slave.port)
+          -- Wrap IPv6-adresses in brackets
+          if (slave.ip:match(":")) then
+            slave.ip = "["..slave.ip.."]"
+          end
           v.slaves[#v.slaves + 1] = slave
         end
       end


More information about the Commits mailing list