mdlayher / raw

Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.
MIT License
425 stars 71 forks source link

raw: Remove length-check of HW addr #58

Closed bluecmd closed 4 years ago

bluecmd commented 4 years ago

This allows non-Ethernet packets to be handled.

Fixes #57

mdlayher commented 4 years ago

Looks like a test may need to be adjusted:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x60a3f6]

goroutine 12 [running]:
testing.tRunner.func1(0xc0000a4700)
    /usr/lib/go/src/testing/testing.go:874 +0x69f
panic(0x647e00, 0x807e00)
    /usr/lib/go/src/runtime/panic.go:679 +0x1b2
github.com/mdlayher/raw.(*packetConn).WriteTo(0xc000034ec8, 0x0, 0x0, 0x0, 0x6ba360, 0xc000034e90, 0x7f4de0, 0xc000034f28, 0x55b0e9)
    /home/build/raw/raw_linux.go:181 +0x196
github.com/mdlayher/raw.Test_packetConnWriteToInvalidHardwareAddr(0xc0000a4700)
    /home/build/raw/raw_linux_test.go:197 +0x19d
testing.tRunner(0xc0000a4700, 0x688280)
    /usr/lib/go/src/testing/testing.go:909 +0x19a
created by testing.(*T).Run
    /usr/lib/go/src/testing/testing.go:960 +0x652
FAIL    github.com/mdlayher/raw 0.011s
FAIL
bluecmd commented 4 years ago

Ping @mdlayher, there we go!