Skip to content

Commit 93c9472

Browse files
authored
Work around GH#4541 (#4560)
1 parent 2ae46b7 commit 93c9472

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scapy/arch/linux/rtnetlink.py

+6
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,9 @@ def read_routes():
887887
ifaces = _get_if_list()
888888
results = _read_routes(socket.AF_INET)
889889
for msg in results:
890+
# Omit stupid answers (some OS conf appears to lead to this)
891+
if msg.rtm_family != socket.AF_INET:
892+
continue
890893
# Process the RTM_NEWROUTE
891894
net = 0
892895
mask = itom(msg.rtm_dst_len)
@@ -937,6 +940,9 @@ def read_routes6():
937940
results = _read_routes(socket.AF_INET6)
938941
lifaddr = _get_ips(af_family=socket.AF_INET6)
939942
for msg in results:
943+
# Omit stupid answers (some OS conf appears to lead to this)
944+
if msg.rtm_family != socket.AF_INET6:
945+
continue
940946
# Process the RTM_NEWROUTE
941947
prefix = "::"
942948
plen = msg.rtm_dst_len

0 commit comments

Comments
 (0)