summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/server4/server.go
diff options
context:
space:
mode:
authorborna-blazevic <54031251+borna-blazevic@users.noreply.github.com>2019-08-14 10:20:28 +0200
committerPablo Mazzini <pmazzini@gmail.com>2019-08-14 09:20:28 +0100
commit393ae75a101b4e8d93f82dd7242401dd50ac0868 (patch)
tree725ec5a42fd2066e71ba284bb9823d08bb0d138b /dhcpv4/server4/server.go
parent6d0d21cc633742eb4de9b08ad7a53572a6907623 (diff)
Bind interface fix (#310)
Added a bind to interface functionality.
Diffstat (limited to 'dhcpv4/server4/server.go')
-rw-r--r--dhcpv4/server4/server.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/dhcpv4/server4/server.go b/dhcpv4/server4/server.go
index 5567bae..fe4ef09 100644
--- a/dhcpv4/server4/server.go
+++ b/dhcpv4/server4/server.go
@@ -123,7 +123,7 @@ func WithConn(c net.PacketConn) ServerOpt {
}
// NewServer initializes and returns a new Server object
-func NewServer(addr *net.UDPAddr, handler Handler, opt ...ServerOpt) (*Server, error) {
+func NewServer(ifname string, addr *net.UDPAddr, handler Handler, opt ...ServerOpt) (*Server, error) {
s := &Server{
Handler: handler,
}
@@ -133,7 +133,7 @@ func NewServer(addr *net.UDPAddr, handler Handler, opt ...ServerOpt) (*Server, e
}
if s.conn == nil {
var err error
- conn, err := net.ListenUDP("udp4", addr)
+ conn, err := NewIPv4UDPConn(ifname, addr.Port)
if err != nil {
return nil, err
}