-
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
panic: runtime error: cgo argument has Go pointer to Go pointer #164
Comments
I am also seeing this with Go 1.6 |
I'm having trouble reproducing this:
|
It happens at runtime for me when using the afpacket mode and fetching the stats using tpacket.SocketStats(). It fails here for me: https://github.com/google/gopacket/blob/master/afpacket/afpacket.go#L293 but I'm able to capture packets without issues. |
I've been discussing this with the golang Google group, and it seems like the pointer checker is a bit overzealous in this case. Their suggestion was to go from:
to something like:
I will try this and report back. |
This should fix the Go runtime panic caused by Go-pointer-to-pointer introduced in Go 1.6.
Could you try this pull request to see if it fixes your issue? |
#180 Did fix the pfring code, I have confirmed that now. As you can see I also added a fix for the socket stats. |
182 merged, closing as I think this is now fixed. |
introduced in Go 1.6. Related to: google#164
pfdump gave following error with go1.6beta2, but working fine with go1.5. Seems like new cgo rules are the reason. See https://tip.golang.org/cmd/cgo/#hdr-Passing_pointers
Starting to read packets
panic: runtime error: cgo argument has Go pointer to Go pointer
goroutine 53 [running]:
github.com/google/gopacket/pfring.(_Ring).ReadPacketDataTo(0xc821280000, 0xc82129a000, 0x10000, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/ws/src/github.com/google/gopacket/pfring/pfring.go:116 +0x210
github.com/google/gopacket/pfring.(_Ring).ReadPacketData(0xc821280000, 0xc82129a000, 0x10000, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/ws/src/github.com/google/gopacket/pfring/pfring.go:135 +0xcb
github.com/google/gopacket.(_PacketSource).NextPacket(0xc821270c60, 0x0, 0x0, 0x0, 0x0)
/root/ws/src/github.com/google/gopacket/packet.go:759 +0x76
github.com/google/gopacket.(_PacketSource).packetsToChannel(0xc821270c60)
/root/ws/src/github.com/google/gopacket/packet.go:776 +0x54
created by github.com/google/gopacket.(*PacketSource).Packets
/root/ws/src/github.com/google/gopacket/packet.go:799 +0x7f
The text was updated successfully, but these errors were encountered: