Skip to content

Fix sniffer join waiting indefinitely #4781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025

Conversation

louis-6wind
Copy link
Contributor

When trying to stop a sniffer that was not already started, Scapy_Exception("Unsupported (offline or unsupported socket)") is no more raised and join() is waiting indefinitely.

Restore the previous stop_cb behavior.

Fixes: 6689da4 ("Add missing type in AsyncSniffer (#4665)")

Checklist:

  • If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • I squashed commits belonging together
  • I added unit tests or explained why they are not relevant
  • [] I executed the regression tests (using cd test && ./run_tests or tox)
  • If the PR is still not finished, please create a Draft Pull Request

fixes #xxx

Co-Authored-By: Louis Scalbert <louis.scalbert@6wind.com>
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.02%. Comparing base (bd7f2a3) to head (fd95d44).
Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4781      +/-   ##
==========================================
- Coverage   81.23%   81.02%   -0.21%     
==========================================
  Files         363      365       +2     
  Lines       88404    89067     +663     
==========================================
+ Hits        71811    72167     +356     
- Misses      16593    16900     +307     
Files with missing lines Coverage Δ
scapy/sendrecv.py 86.53% <100.00%> (+0.11%) ⬆️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gpotter2
Copy link
Member

Thanks for the PR. Although I don't understand how you can reach this code (running remains False until you start() ?!), I agree that the current test is broken.

@gpotter2 gpotter2 merged commit 0a36696 into secdev:master Jul 17, 2025
24 checks passed
@louis-6wind
Copy link
Contributor Author

Thank you for the merge. But it is not working for me

Traceback (most recent call last):
  File "/usr/sbin/XXXXX, line 774, in sniffer_close
    sniffer.stop()
  File "/usr/local/lib/python3.12/dist-packages/scapy/sendrecv.py", line 1404, in stop
    if self.continue_sniff:
       ^^^^^^^^^^^^^^^^^^^
AttributeError: 'AsyncSniffer' object has no attribute 'continue_sniff'

@louis-6wind
Copy link
Contributor Author

louis-6wind commented Jul 21, 2025

To reproduce:

from scapy.all import AsyncSniffer
sniffer=AsyncSniffer(
    iface="ens3",
    store=False,
    promisc=False,
)
sniffer.start()
sniffer.stop()

I got:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.12/dist-packages/scapy/sendrecv.py", line 1404, in stop
if self.continue_sniff:
^^^^^^^^^^^^^^^^^^^
AttributeError: 'AsyncSniffer' object has no attribute 'continue_sniff'

Basically I am monitoring the interfaces with netlink to start/stop sniffer. It happens in case of flapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy