summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2022-09-10 13:50:22 +0100
committerGitHub <noreply@github.com>2022-09-10 13:50:22 +0100
commited9727950b066e43d8e41db9da1efcd9daa8fa24 (patch)
tree0931599b9453ae63d065ed2116ee75589725ed81 /dhcpv4
parentd7ed3daa838be80ff2d77154a3114535debf98a1 (diff)
parent69cde97383c2cb98112b7dd6e4b20198b8c38353 (diff)
Merge branch 'master' into lint
Diffstat (limited to 'dhcpv4')
-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 {