Skip to content
Snippets Groups Projects
Commit 567fa0a7 authored by Guillaume Valadon's avatar Guillaume Valadon Committed by GitHub
Browse files

Merge pull request #758 from p-l-/fix-sniff

Linux/sniff: warn instead of crash when we fail to create a valid filter
parents 94d8dba3 b8c7d3ed
No related branches found
No related tags found
No related merge requests found
......@@ -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:]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment