Skip to content

Incorrect Exception when linktype conflict with filter #4587

Description

@m8k7j

Brief description

when I using Asnysniffer with filter, sometime the program will blocked at compile_filter, then when I stop Asynsniffer, there is no attribute stop_cb.

Scapy version

2.6.0

Python version

3.11

Operating system

ubuntu 20.04

Additional environment information

No response

How to reproduce

  • enable Asynsniffer
  • send some packet with scapy
  • stop Asynsniffer

Actual result

have no attribute stop_cb

Expected result

have no error when finished sniffer capture

Related resources

No response

Activity

  1. m8k7j commented on Nov 11, 2024

    @m8k7j
    Author

    reproduce step:

    from scapy.sendrecv import AsyncSniffer
    import time
    
    count = 0
    sniffer = AsyncSniffer(iface='eth0', filter='wlan type mgt subtype deauth')
    sniffer.start()
    time.sleep(1)
    sniffer.stop()
    print(f'success {count}')

    expect result is
    raise Scapy_Exception(scapy.error.Scapy_Exception: Cannot set filter
    real result is
    raise Scapy_Exception(scapy.error.Scapy_Exception: Unsupported (offline or unsupported socket)

  2. changed the title [-]code blocked at `compile_filter` in scapy[/-] [+]Incorrect Exception when linktype conflict with filter[/+] on Nov 11, 2024
  3. Mo-way commented on Sep 16, 2025

    @Mo-way

    This also hit me, when I had a typo in the filter:

    sniffy = AsyncSniffer(iface="wlp0s20f3", filter="not arpand not port 22")
    

    See: https://stackoverflow.com/q/79766638/21826195

    Took some time to figure it out, because the same error also arises from timing issues: https://stackoverflow.com/q/70559382/21826195

  4. added a commit that references this issue on Jun 22, 2026
    6ba0390
  5. added a commit that references this issue on Jun 27, 2026
    f9430fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions