Pull request: 3166 fix dhcp
Updates #3166.
Squashed commit of the following:
commit cac62f842886f06a70fb50d251938e0feaa06846
Author: Ildar Kamalov <ik@adguard.com>
Date: Thu Jun 10 14:35:40 2021 +0300
client: get dhcp status on static lease submit
commit 2ae4e3ab40041fbc0f53f4902a00263425409a6a
Merge: 1e0f9c15 299ea88c
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Jun 10 14:09:05 2021 +0300
Merge branch 'master' into 3166-fix-dhcp
commit 1e0f9c15d98f40a499c75b74bca48fe58512e300
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Jun 10 14:03:58 2021 +0300
dhcpd: imp code
commit e4b9626b60a11cd2491c675a297f527f7e12f9b4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Jun 10 13:03:47 2021 +0300
dhcpd: fix static lease load
commit dc449f21986a8ea300d07c081f1e416b2f08bc25
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Jun 1 17:21:10 2021 +0300
home: change clients sources priority
This commit is contained in:
@@ -53,13 +53,11 @@ type Client struct {
|
||||
type clientSource uint
|
||||
|
||||
// Client sources. The order determines the priority.
|
||||
//
|
||||
// TODO(e.burkov): Is ARP a higher priority source than DHCP?
|
||||
const (
|
||||
ClientSourceWHOIS clientSource = iota
|
||||
ClientSourceRDNS
|
||||
ClientSourceDHCP
|
||||
ClientSourceARP
|
||||
ClientSourceDHCP
|
||||
ClientSourceHostsFile
|
||||
)
|
||||
|
||||
|
||||
@@ -151,6 +151,20 @@ func TestClients(t *testing.T) {
|
||||
assert.True(t, clients.Exists("1.1.1.1", ClientSourceHostsFile))
|
||||
})
|
||||
|
||||
t.Run("dhcp_replaces_arp", func(t *testing.T) {
|
||||
ok, err := clients.AddHost("1.2.3.4", "from_arp", ClientSourceARP)
|
||||
require.NoError(t, err)
|
||||
assert.True(t, ok)
|
||||
|
||||
assert.True(t, clients.Exists("1.2.3.4", ClientSourceARP))
|
||||
|
||||
ok, err = clients.AddHost("1.2.3.4", "from_dhcp", ClientSourceDHCP)
|
||||
require.NoError(t, err)
|
||||
assert.True(t, ok)
|
||||
|
||||
assert.True(t, clients.Exists("1.2.3.4", ClientSourceDHCP))
|
||||
})
|
||||
|
||||
t.Run("addhost_fail", func(t *testing.T) {
|
||||
ok, err := clients.AddHost("1.1.1.1", "host1", ClientSourceRDNS)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user