-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Set afpacket socket in promiscuous mode #564
Comments
This would be very helpful as it could help in some scenarios where we don't see any packets unless it's set to promiscuous mode. Is there any plan to include this? Current workaround is |
Using reflect, so very dirty :) func setPromiscuous(tp *afpacket.TPacket, ifidx int, on bool) error {
mreq := unix.PacketMreq{
Ifindex: int32(ifidx),
Type: unix.PACKET_MR_PROMISC,
}
opt := unix.PACKET_DROP_MEMBERSHIP
if on {
opt = unix.PACKET_ADD_MEMBERSHIP
}
fd := int(reflect.ValueOf(tp).Elem().FieldByName("fd").Int())
return unix.SetsockoptPacketMreq(fd, unix.SOL_PACKET, opt, &mreq)
}
|
maxatome
added a commit
to maxatome/gopacket
that referenced
this issue
Apr 26, 2024
Closes google#564. Signed-off-by: Maxime Soulé <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice to be able to set the socket in promiscuous mode.
perhaps something like this:
The text was updated successfully, but these errors were encountered: