diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py index 30cdb416ceaf88582b6af0c65b7e8480c6d5e1cf..9ad10235e1c9d7c6754c27a2a0ffb830f343fffc 100644 --- a/scapy/arch/linux.py +++ b/scapy/arch/linux.py @@ -139,12 +139,17 @@ def attach_filter(s, bpf_filter, iface): conf.iface if iface is None else iface, bpf_filter, )) - except OSError as msg: - log_interactive.warning("Failed to execute tcpdump: (%s)") + except OSError: + log_interactive.warning("Failed to attach filter.", + exc_info=True) return lines = f.readlines() - if f.close(): - raise Scapy_Exception("Filter parse error") + ret = f.close() + if ret: + log_interactive.warning( + "Failed to attach filter: tcpdump returned %d", ret + ) + return nb = int(lines[0]) bpf = "" for l in lines[1:]: