Pull request: 2723 autogenerate hostnames
Merge in DNS/adguard-home from 2723-dhcp-hostnames to master
Updates #2723.
Squashed commit of the following:
commit f9b9d2269c25cabd225ba712730f04496ab81715
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Apr 15 16:47:31 2021 +0300
aghnet: fix test
commit a2845d1003093ce38870b2cc89e9bd98ea2b8249
Merge: 74e450c9 0bcea347
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Apr 15 16:45:59 2021 +0300
Merge branch 'master' into 2723-dhcp-hostnames
commit 74e450c919b4c39ed6f8489aea398b225a4c6861
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Apr 15 16:44:08 2021 +0300
all: imp code, docs
commit 77cdb1232d18c8a2642b7131f051e318844c2c47
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Apr 15 14:29:40 2021 +0300
all: add gen func, use it
This commit is contained in:
@@ -634,13 +634,19 @@ func (s *v4Server) processRequest(req, resp *dhcpv4.DHCPv4) (lease *Lease, ok bo
|
||||
}
|
||||
|
||||
if !lease.IsStatic() {
|
||||
lease.Hostname, err = s.normalizeHostname(req.HostName())
|
||||
var hostname string
|
||||
hostname, err = s.normalizeHostname(req.HostName())
|
||||
if err != nil {
|
||||
log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
if hostname == "" {
|
||||
hostname = aghnet.GenerateHostName(reqIP)
|
||||
}
|
||||
|
||||
lease.Hostname = hostname
|
||||
s.commitLease(lease)
|
||||
} else if len(lease.Hostname) != 0 {
|
||||
o := &optFQDN{
|
||||
|
||||
Reference in New Issue
Block a user