Skip to content

Commit 0b7288c

Browse files
authored
Worker: Bind to the first non-link-local IPv4 address
1 parent ff8689a commit 0b7288c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cluster.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,10 @@ function init_bind_addr()
12921292
else
12931293
bind_port = 0
12941294
try
1295-
bind_addr = string(getipaddr())
1295+
# Use the first non-link-local IPv4 address
1296+
addrs = Sockets.getipaddrs(Sockets.IPv4)
1297+
filter!(!Sockets.islinklocaladdr, addrs)
1298+
bind_addr = string(first(addrs))
12961299
catch
12971300
# All networking is unavailable, initialize bind_addr to the loopback address
12981301
# Will cause an exception to be raised only when used.

0 commit comments

Comments
 (0)