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

Add ability to access DGRAM packet sockets on Linux. #21

Closed hugelgupf closed 6 years ago

hugelgupf commented 6 years ago

Not sure this is exactly what you would want, so I thought I'd just send it for review.

hugelgupf commented 6 years ago

ping?

mdlayher commented 6 years ago

Interesting change. Do you have a concrete use case for this?

It can probably go in, but we may want to look at an additional options API for platform-specific options like this.

hugelgupf commented 6 years ago

I'm just tired of filling in ethernet headers myself in DHCP clients. (at least the v4 seems to currently have a need for raw sockets.)

hugelgupf commented 6 years ago

(Actually, I likely won't need to do all that after all, so nevermind :))

mdlayher commented 6 years ago

I forgot that DHCP clients may be a bit more awkward than servers since they don't have an IP yet. Let me know if you find a workable solution either way.

hugelgupf commented 6 years ago

Actually, I would like to get this in. I'm trying to eventually not use this, but right now this is the only way I can make my client work. I may have to screw with SO_BINDTODEVICE to get regular sockets to work. At least for DHCPv4 raw sockets seem to be necessary right now. (DHCPv6 at least has the EUI64 address to bind to...)

mdlayher commented 6 years ago

Superseded by #23.