Skip to content

Conversation

@fako1024
Copy link
Owner

@fako1024 fako1024 commented Nov 13, 2025

Restructures the internal API for the socket options into a struct{} based one (too many options in the method signature anyway) and hence allows exposure of a new option function for afring / afpacket sources:

listener, err := afring.NewSource(devName,
	afring.CaptureLength(filter.CaptureLengthFixed(64)),
	afring.BufferSize((1<<20), 4),
	afring.Promiscuous(false),
	afring.IgnoreVLANs(ignoreVLANs),
	afring.DisableAutoBPF(),                   // Additional option (no breaking API change on this level)
)

Using this there will be no BPF filtering introduced beyond the flag-based ones (i.e. snaplen, promiscious mode and VLAN ignore mode).

Extra BPF instructions can still be provided in this mode, effectively providing the option to set arbitrary BPF from scratch.

Closes #96

@fako1024 fako1024 linked an issue Nov 13, 2025 that may be closed by this pull request
@fako1024 fako1024 self-assigned this Nov 13, 2025
@fako1024 fako1024 added the enhancement New feature or request label Nov 13, 2025
@fako1024 fako1024 requested a review from els0r November 13, 2025 16:02
@fako1024 fako1024 changed the title Adjust internal socket API for apacket / afring to support no-limit BPF filter option Adjust internal socket API for afpacket / afring to support no-limit BPF filter option Nov 13, 2025
@fako1024 fako1024 marked this pull request as ready for review November 14, 2025 15:38
@fako1024 fako1024 merged commit 65b806c into main Nov 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

capture: Support receiving packets with etherTypes like 0x88B5

3 participants