diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2022-09-10 13:50:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 13:50:02 +0100 |
commit | 69cde97383c2cb98112b7dd6e4b20198b8c38353 (patch) | |
tree | 6014bff2e03a3aa70ea60dd1e06c91c17ea4cded | |
parent | de18a9d48e84748150efb41d6ff584f70a807ecb (diff) | |
parent | cb978496120c84d3109ff78e8ea1cd919c0ba479 (diff) |
Merge pull request #476 from jacobweinstock/patch-1
Update conn_unix.go
-rw-r--r-- | dhcpv4/server4/conn_unix.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/dhcpv4/server4/conn_unix.go b/dhcpv4/server4/conn_unix.go index da62398..18dd986 100644 --- a/dhcpv4/server4/conn_unix.go +++ b/dhcpv4/server4/conn_unix.go @@ -33,6 +33,10 @@ func NewIPv4UDPConn(iface string, addr *net.UDPAddr) (*net.UDPConn, error) { if err := unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_REUSEADDR, 1); err != nil { return nil, fmt.Errorf("cannot set reuseaddr on socket: %v", err) } + // Allow reusing the port to aid debugging and testing. + if err := unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil { + return nil, fmt.Errorf("cannot set reuseport on socket: %v", err) + } if len(iface) != 0 { // Bind directly to the interface. if err := dhcpv4.BindToInterface(fd, iface); err != nil { |