d2g / dhcp4client

DHCP Client
Mozilla Public License 2.0
38 stars 30 forks source link

Added ability to use AF_PACKET socket #2

Closed eyakubovich closed 9 years ago

eyakubovich commented 9 years ago

Using AF_PACKET is necessary to: (a) allow bcast traffic to go thru rp_filter enabled (b) ability to not use Broadcast flag and get packets unicasted back.

d2g commented 9 years ago

Thanks.

I'll review and get back to you.

d2g commented 9 years ago

For Reference: Extra info around the syscall package - https://golang.org/s/go1.4-syscall

d2g commented 9 years ago

I've pushed this to a separate branch (af_packet-sock) as I'm unable to see if it even build on Linux ( Windows Desktop :( ) I'll test later as some stage but I've changed the API so that you should find:

s, err := dhcp4client.NewPacketSock(10) ... c, err := dhcp4client.New(dhcp4client.HardwareAddr(m),dhcp4client.Connection(s)) ...

Works.

eyakubovich commented 9 years ago

I like the changes. I didn't want to break the existing API but if that's ok, this cleans it up. I also realized that why I had a build tag on pktsock.go, there was nothing to disable ConnectPacket() function so it probably failed on non-Linux systems.

d2g commented 9 years ago

Let me know if you want me to version 1 this release and I'll start making sure I don't make any api changes within this version.