Skip to content

Commit

Permalink
Fix binding to a localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Mar 5, 2024
1 parent 8659b74 commit 6b76853
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Fixed

- Raft failover state transitions.

- Remote control socket doesn't bind to a localhost when different host is available.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
14 changes: 13 additions & 1 deletion cartridge/confapplier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,19 @@ local function init(opts)
return nil, InitError:new("Could not resolve advertise uri %s", opts.advertise_uri)
end

local ok, err = remote_control.bind(addrinfo[1].host, vars.binary_port, {
local host = addrinfo[1].host
if parts.host ~= 'localhost' then
for _, addr in ipairs(addrinfo) do
if family == 'AF_INET' and addr.host ~= '127.0.0.1'
or family == 'AF_INET6' and addr.host ~= '::1'
then
host = addr.host
break
end
end
end

local ok, err = remote_control.bind(host, vars.binary_port, {
transport = vars.transport, -- '' or 'ssl'
ssl_ciphers = vars.ssl_ciphers,
ssl_ca_file = vars.ssl_server_ca_file,
Expand Down

0 comments on commit 6b76853

Please sign in to comment.