Skip to content

Commit

Permalink
Work around GH#4541 (#4560)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 authored Oct 6, 2024
1 parent 2ae46b7 commit 93c9472
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scapy/arch/linux/rtnetlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 93c9472

Please sign in to comment.