From 0e22d1834f16442b0c506a1ea27175631c007025 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Tue, 4 Aug 2026 17:46:35 +0000 Subject: [PATCH] pfroute: extract netmasks correctly on Darwin/NetBSD by skipping the 2-byte sin_port field and switching to the network byte order when RTA_NETMASKs are parsed. Apart from the unit tests it was tested on NetBSD (32 and 64 bit) and Darwin and also cross-checked with netstat and route. It's a follow-up to 528626a02c7bfa404a85857375da5f9b3203ebaa. AI-Assisted: no --- scapy/arch/bpf/pfroute.py | 4 ++-- test/regression.uts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scapy/arch/bpf/pfroute.py b/scapy/arch/bpf/pfroute.py index dcb78457c63..b249490302d 100644 --- a/scapy/arch/bpf/pfroute.py +++ b/scapy/arch/bpf/pfroute.py @@ -1064,8 +1064,8 @@ def read_routes(): nm = msg.addrs[i] if nm.sa_family == socket.AF_INET: mask = atol(nm.sin_addr) - elif nm.sa_family in [0x00, 0xFF]: # NetBSD - mask = struct.unpack("