Skip to content

Incorrect handling of SETSOCKOPT when setting promisc mode #100

@fako1024

Description

@fako1024

In a production setup we randomly observe this:

ts=2026-04-24T15:26:37.561+02:00 level=error msg="failed to start capture: failed to initialize capture: failed to set AF_PACKET socket options on eth0: failed to set promiscuous mode: invalid argument" version=4.2.5-ec768152 iface=eth0

Analysis shows:

  • In capture/afpacket/socket/socket.go:107, optlen is passed as uintptr(unsafe.Pointer(&reqLen)) (pointer), but setsockopt expects the length value.
  • The same call uses unix.SOL_SOCKET for PACKET_ADD_MEMBERSHIP; packet membership options are handled at SOL_PACKET.

So this line is effectively malformed in two ways. That can produce EINVAL (invalid argument).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions