Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't include link-local addresses (169.254) in public_ips #1040

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion jupyter_client/localinterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def _populate_from_list(addrs: Sequence[str] | None) -> None:
for ip in addrs:
local_ips.append(ip)
if not ip.startswith("127."):
public_ips.append(ip)
if not ip.startswith("169.254."):
# don't include link-local address in public_ips
public_ips.append(ip)
elif not LOCALHOST:
LOCALHOST = ip

Expand Down Expand Up @@ -168,6 +170,9 @@ def _load_ips_psutil() -> None:
addr = address_data.address
if not (iface.startswith("lo") or addr.startswith("127.")):
public_ips.append(addr)
elif addr.startswith("169.254."):
# don't include link-local address in public_ips
pass
elif not LOCALHOST:
LOCALHOST = addr
local_ips.append(addr)
Expand Down Expand Up @@ -198,6 +203,9 @@ def _load_ips_netifaces() -> None:
continue
if not (iface.startswith("lo") or addr.startswith("127.")):
public_ips.append(addr)
elif addr.startswith("169.254."):
# don't include link-local address in public_ips
pass
elif not LOCALHOST:
LOCALHOST = addr
local_ips.append(addr)
Expand Down
Loading