- /control/dhcp/find_active_dhcp: fix DHCP server detection

Before this patch we couldn't receive incoming DHCP packets.
Now we bind() to 0.0.0.0 and set the required network interface
 using SO_BINDTODEVICE option.

As an improvement, we now wait until a reply to our request is
 received and skip all unknown packets.
This commit is contained in:
Simon Zolin
2019-04-16 17:36:34 +03:00
parent 69c5f175e8
commit c5ed6da5bd
3 changed files with 106 additions and 40 deletions

12
dhcpd/os_windows.go Normal file
View File

@@ -0,0 +1,12 @@
package dhcpd
import (
"net"
"golang.org/x/net/ipv4"
)
// Create a socket for receiving broadcast packets
func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, nil
}