summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4')
-rw-r--r--dhcpv4/modifiers_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/dhcpv4/modifiers_test.go b/dhcpv4/modifiers_test.go
index 3617deb..274b409 100644
--- a/dhcpv4/modifiers_test.go
+++ b/dhcpv4/modifiers_test.go
@@ -162,3 +162,22 @@ func TestWithRouter(t *testing.T) {
ortr := d.Router()
require.Equal(t, rtr, ortr[0])
}
+
+func TestWithRelayAgentInfo(t *testing.T) {
+ req, _ := New(WithGeneric(OptionRelayAgentInformation, []byte{
+ 1, 5, 'l', 'i', 'n', 'u', 'x',
+ 2, 4, 'b', 'o', 'o', 't',
+ }))
+ req.OpCode = OpcodeBootRequest
+
+ resp, _ := NewReplyFromRequest(req)
+
+ opt := resp.RelayAgentInfo()
+ require.NotNil(t, opt)
+ require.Equal(t, len(opt.Options), 2)
+
+ circuit := opt.Get(GenericOptionCode(1))
+ remote := opt.Get(GenericOptionCode(2))
+ require.Equal(t, circuit, []byte("linux"))
+ require.Equal(t, remote, []byte("boot"))
+}