File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ def _populate_from_list(addrs: Sequence[str] | None) -> None:
87
87
for ip in addrs :
88
88
local_ips .append (ip )
89
89
if not ip .startswith ("127." ):
90
- public_ips .append (ip )
90
+ if not ip .startswith ("169.254." ):
91
+ # don't include link-local address in public_ips
92
+ public_ips .append (ip )
91
93
elif not LOCALHOST :
92
94
LOCALHOST = ip
93
95
@@ -168,6 +170,9 @@ def _load_ips_psutil() -> None:
168
170
addr = address_data .address
169
171
if not (iface .startswith ("lo" ) or addr .startswith ("127." )):
170
172
public_ips .append (addr )
173
+ elif addr .startswith ("169.254." ):
174
+ # don't include link-local address in public_ips
175
+ pass
171
176
elif not LOCALHOST :
172
177
LOCALHOST = addr
173
178
local_ips .append (addr )
@@ -198,6 +203,9 @@ def _load_ips_netifaces() -> None:
198
203
continue
199
204
if not (iface .startswith ("lo" ) or addr .startswith ("127." )):
200
205
public_ips .append (addr )
206
+ elif addr .startswith ("169.254." ):
207
+ # don't include link-local address in public_ips
208
+ pass
201
209
elif not LOCALHOST :
202
210
LOCALHOST = addr
203
211
local_ips .append (addr )
You can’t perform that action at this time.
0 commit comments