Pull request: dhcpd: fix interface ipv6 check

Merge in DNS/adguard-home from 2355-dhcpcheck-ipv6 to master

Updates #2335.

Squashed commit of the following:

commit 5ce1cc7bc244ba5dd4a065d47dec8884fa3d45e7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 14:03:24 2020 +0300

    dhcpd: fix loop exit condition

commit 32b4b946bfa30159326dc295fa1a2607b78172af
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Nov 25 13:26:50 2020 +0300

    dhcpd: fix interface ipv6 check
This commit is contained in:
Ainar Garipov
2020-11-25 14:26:26 +03:00
parent 284da7c91b
commit 36c7735b85
9 changed files with 103 additions and 66 deletions

View File

@@ -17,17 +17,13 @@ import (
"github.com/u-root/u-root/pkg/uio"
)
var (
// BroadcastMac is the broadcast MAC address.
//
// Any UDP packet sent to this address is broadcast on the subnet.
BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255})
)
// BroadcastMac is the broadcast MAC address.
//
// Any UDP packet sent to this address is broadcast on the subnet.
var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255})
var (
// ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr".
ErrUDPAddrIsRequired = errors.New("must supply UDPAddr")
)
// ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr".
var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr")
// NewRawUDPConn returns a UDP connection bound to the interface and port
// given based on a raw packet socket. All packets are broadcasted.
@@ -68,7 +64,7 @@ func NewBroadcastUDPConn(rawPacketConn net.PacketConn, boundAddr *net.UDPAddr) n
}
}
func udpMatch(addr *net.UDPAddr, bound *net.UDPAddr) bool {
func udpMatch(addr, bound *net.UDPAddr) bool {
if bound == nil {
return true
}