summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/server4/conn_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4/server4/conn_unix.go')
-rw-r--r--dhcpv4/server4/conn_unix.go4
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 {