+ dhcp custom options
Squashed commit of the following:
commit 140ac16568383cab2270e5d5ba895959902dd943
Merge: d5ed73b5 cb6ca3b0
Author: Simon Zolin <s.zolin@adguard.com>
Date: Tue Aug 25 13:46:34 2020 +0300
Merge remote-tracking branch 'origin/master' into 1585-dhcp-options
commit d5ed73b5e4f068b823fe97ab1161753670d10387
Author: Simon Zolin <s.zolin@adguard.com>
Date: Fri Aug 21 18:16:41 2020 +0300
minor
commit f5208a0b050c2dd462b32edee0379758cc6e5003
Author: Simon Zolin <s.zolin@adguard.com>
Date: Mon Jun 1 14:09:39 2020 +0300
+ dhcpv4 custom options
This commit is contained in:
@@ -108,3 +108,25 @@ func TestNormalizeLeases(t *testing.T) {
|
||||
assert.True(t, bytes.Equal(leases[1].HWAddr, []byte{2, 2, 3, 4}))
|
||||
assert.True(t, bytes.Equal(leases[2].HWAddr, []byte{1, 2, 3, 5}))
|
||||
}
|
||||
|
||||
func TestOptions(t *testing.T) {
|
||||
code, val := parseOptionString(" 12 hex abcdef ")
|
||||
assert.Equal(t, uint8(12), code)
|
||||
assert.True(t, bytes.Equal([]byte{0xab, 0xcd, 0xef}, val))
|
||||
|
||||
code, _ = parseOptionString(" 12 hex abcdef1 ")
|
||||
assert.Equal(t, uint8(0), code)
|
||||
|
||||
code, val = parseOptionString("123 ip 1.2.3.4")
|
||||
assert.Equal(t, uint8(123), code)
|
||||
assert.Equal(t, "1.2.3.4", net.IP(string(val)).String())
|
||||
|
||||
code, _ = parseOptionString("256 ip 1.1.1.1")
|
||||
assert.Equal(t, uint8(0), code)
|
||||
code, _ = parseOptionString("-1 ip 1.1.1.1")
|
||||
assert.Equal(t, uint8(0), code)
|
||||
code, _ = parseOptionString("12 ip 1.1.1.1x")
|
||||
assert.Equal(t, uint8(0), code)
|
||||
code, _ = parseOptionString("12 x 1.1.1.1")
|
||||
assert.Equal(t, uint8(0), code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user