Open woguwo opened 2 years ago
Hello, I encountered a problem during use in Macos, As follows:
panic: runtime error: slice bounds out of range [:4098] with capacity 4096 goroutine 886516 [running]: github.com/mdlayher/raw.(*packetConn).ReadFrom(0xc0061cd6e0, {0xc005833280, 0x80, 0x80}) /github.com/mdlayher/raw/raw_bsd.go:163 +0x9e5 github.com/mdlayher/raw.(*Conn).ReadFrom(0xc00462e278, {0xc005833280, 0x80, 0x80}) /github.com/mdlayher/raw/raw.go:47 +0x99
I searched the source code and found the problem here on raw_bsd.go:
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) { ...... // Skip past BPF header to retrieve ethernet frame out := copy(b, buf[bpfl:bpfl+n]) ...... }
I carefully sorted out your logic. I think there's a small problem. Should it be:
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) { ....... // Skip past BPF header to retrieve ethernet frame out := copy(b, buf[bpfl:n]) ...... }
I don't know if the understanding is correct. Please correct it. Thank you!
Hello, I encountered a problem during use in Macos, As follows:
I searched the source code and found the problem here on raw_bsd.go:
I carefully sorted out your logic. I think there's a small problem. Should it be:
I don't know if the understanding is correct. Please correct it. Thank you!