Pull request: 2582 invalid hostname vol.3
Merge in DNS/adguard-home from 2582-zero-byte to master Updates #2582. Squashed commit of the following: commit 88db23f26cd6ee9978310c7030f6866b9ef58785 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Mar 11 13:01:02 2021 +0300 dhcpd: rm temporary workaround
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -464,16 +463,7 @@ func (s *v4Server) processRequest(req, resp *dhcpv4.DHCPv4) (*Lease, bool) {
|
||||
}
|
||||
|
||||
if lease.Expiry.Unix() != leaseExpireStatic {
|
||||
// The trimming is required since some devices include trailing
|
||||
// zero-byte in DHCP option length calculation.
|
||||
//
|
||||
// See https://github.com/AdguardTeam/AdGuardHome/issues/2582.
|
||||
//
|
||||
// TODO(e.burkov): Remove after the trimming for hostname option
|
||||
// will be added into github.com/insomniacslk/dhcp module.
|
||||
hostnameStr := strings.TrimRight(string(hostname), "\x00")
|
||||
|
||||
lease.Hostname = hostnameStr
|
||||
lease.Hostname = string(hostname)
|
||||
s.commitLease(lease)
|
||||
} else if len(lease.Hostname) != 0 {
|
||||
o := &optFQDN{
|
||||
|
||||
@@ -46,7 +46,8 @@ func ip6InRange(start, ip net.IP) bool {
|
||||
if len(start) != 16 {
|
||||
return false
|
||||
}
|
||||
//lint:ignore SA1021 TODO(e.burkov): Ignore this for now, think about using masks.
|
||||
//lint:ignore SA1021 TODO(e.burkov): Ignore this for now, think about
|
||||
// using masks.
|
||||
if !bytes.Equal(start[:15], ip[:15]) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user