Work around GH#4541 (#4560)

This commit is contained in:
gpotter2 2024-10-06 23:36:15 +02:00 committed by GitHub
parent 2ae46b79c9
commit 93c94722da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -887,6 +887,9 @@ def read_routes():
ifaces = _get_if_list()
results = _read_routes(socket.AF_INET)
for msg in results:
# Omit stupid answers (some OS conf appears to lead to this)
if msg.rtm_family != socket.AF_INET:
continue
# Process the RTM_NEWROUTE
net = 0
mask = itom(msg.rtm_dst_len)
@ -937,6 +940,9 @@ def read_routes6():
results = _read_routes(socket.AF_INET6)
lifaddr = _get_ips(af_family=socket.AF_INET6)
for msg in results:
# Omit stupid answers (some OS conf appears to lead to this)
if msg.rtm_family != socket.AF_INET6:
continue
# Process the RTM_NEWROUTE
prefix = "::"
plen = msg.rtm_dst_len