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:
parent
c08bf86b71
commit
94e21e69af
2
go.mod
2
go.mod
@ -16,7 +16,7 @@ require (
|
||||
github.com/gobuffalo/packr/v2 v2.8.1 // indirect
|
||||
github.com/google/go-cmp v0.5.5 // indirect
|
||||
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210306224058-018caddcb1eb
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2
|
||||
github.com/kardianos/service v1.2.0
|
||||
github.com/karrick/godirwalk v1.16.1 // indirect
|
||||
github.com/lucas-clemente/quic-go v0.19.3
|
||||
|
4
go.sum
4
go.sum
@ -216,8 +216,8 @@ github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714/go.mod h1:2Go
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210306224058-018caddcb1eb h1:IlbQi/Y9BmwqtsT+IfctERmRQcNsw4HvLAOSx16GseY=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210306224058-018caddcb1eb/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2 h1:NpTIlXznCStsY88jU+Gh1Dy5dt/jYV4z4uU8h2TUOt4=
|
||||
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user