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_bsd was checking non syscall error agains syscall errno. #2

Closed ganparse closed 7 years ago

ganparse commented 7 years ago

raw_bsd was checking non syscall error agains syscall errno which would lead to issues when BPF0 is busy. This change will allow retry on BPF 1-9 if 0 is busy.

os.OpenFile returns a path error and not a syscall error. As such, comparing the error returned to syscall.EBUSY will always return false even when the returned error is a resource busy error. This change makes it so the busy error is checked for and in the case the resource is busy the next BPF resource will be tried instead.

Tested on OS X, where I was having an issue with the raw library always quitting after returning an error of BPF0 being busy.

mdlayher commented 7 years ago

Looks good to me, thanks! Will merge once the build passes.