Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Import Exception for scapy.layers.l2 on MacOS #4787

Closed
@mdennis281

Description

Brief description

I used scapy lightly on my macbook then i started getting an error on import for scapy.layers.l2. tried recreating the venv, but it seems the problem persists across venvs

Scapy version

2.6.1

Python version

3.13.5

Operating system

MacOS M3 Sequoia 15.5

Additional environment information

I was running thousands of ARP lookups before this started happening.
requests similar to this:

arp_request = ARP(pdst='0.0.0.0')
broadcast = Ether(dst="ff:ff:ff:ff:ff:ff")
packet = broadcast / arp_request
srp(packet, timeout=0, verbose=False)

How to reproduce

Get a macbook (mine is M3)
Join a local network with a large subnet, with a mask <20 ( over 4096 possible IPs )
run: import scapy.layers.l2

Actual result

>>> from scapy.all import ARP, Ether, srp
Traceback (most recent call last):
 File "<python-input-1>", line 1, in <module>
 from scapy.all import ARP, Ether, srp
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/all.py", line 26, in <module>
 from scapy.route import *
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/route.py", line 247, in <module>
 conf.route = Route()
 ~~~~~^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/route.py", line 37, in __init__
 self.resync()
 ~~~~~~~~~~~^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/route.py", line 47, in resync
 self.routes = read_routes()
 ~~~~~~~~~~~^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/arch/bpf/pfroute.py", line 1011, in read_routes
 resp = _sr1_bsdsysctl(mib)
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/arch/bpf/pfroute.py", line 988, in _sr1_bsdsysctl
 return pfmsghdrs(bytes(oldp))
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/base_classes.py", line 481, in __call__
 i.__init__(*args, **kargs)
 ~~~~~~~~~~^^^^^^^^^^^^^^^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/packet.py", line 186, in __init__
 self.dissect(_pkt)
 ~~~~~~~~~~~~^^^^^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/packet.py", line 1082, in dissect
 s = self.do_dissect(s)
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/packet.py", line 1020, in do_dissect
 s, fval = f.getfield(self, s)
 ~~~~~~~~~~^^^^^^^^^
 File "/Users/michaeldennis/Documents/GitHub/LANscape/.env/lib/python3.13/site-packages/scapy/fields.py", line 1836, in getfield
 raise MaximumItemsCount(
 ...<3 lines>...
 )
scapy.fields.MaximumItemsCount: Maximum amount of items reached in PacketListField: 4096 (defaults to conf.max_list_count)

NOTE: the instance where this is happening is not leveraging the conf.max_list_count, but rather overridden using an optional arg on class instantiation

Expected result

Not a failure on import

Related resources

exo-explore/exo#795

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

        AltStyle によって変換されたページ (->オリジナル) /