summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6relay_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/dhcpv6relay_test.go')
-rw-r--r--dhcpv6/dhcpv6relay_test.go26
1 files changed, 10 insertions, 16 deletions
diff --git a/dhcpv6/dhcpv6relay_test.go b/dhcpv6/dhcpv6relay_test.go
index c383487..3e37e63 100644
--- a/dhcpv6/dhcpv6relay_test.go
+++ b/dhcpv6/dhcpv6relay_test.go
@@ -31,7 +31,7 @@ func TestRelayMessage(t *testing.T) {
if pa := r.PeerAddr; !pa.Equal(ma) {
t.Fatalf("Invalid peer address. Expected %v, got %v", ma, pa)
}
- if opts := r.Options; len(opts) != 0 {
+ if opts := r.Options.Options; len(opts) != 0 {
t.Fatalf("Invalid options. Expected none, got %v", opts)
}
}
@@ -70,18 +70,14 @@ func TestRelayMessageToBytes(t *testing.T) {
LinkAddr: net.IPv6interfacelocalallnodes,
PeerAddr: net.IPv6linklocalallrouters,
}
- opt := OptRelayMsg{
- relayMessage: &Message{
- MessageType: MessageTypeSolicit,
- TransactionID: TransactionID{0xaa, 0xbb, 0xcc},
- Options: MessageOptions{
- Options: []Option{
- OptElapsedTime(0),
- },
- },
- },
- }
- r.AddOption(&opt)
+ opt := OptRelayMessage(&Message{
+ MessageType: MessageTypeSolicit,
+ TransactionID: TransactionID{0xaa, 0xbb, 0xcc},
+ Options: MessageOptions{[]Option{
+ OptElapsedTime(0),
+ }},
+ })
+ r.AddOption(opt)
relayBytes := r.ToBytes()
if !bytes.Equal(expected, relayBytes) {
t.Fatalf("Invalid ToBytes result. Expected %v, got %v", expected, relayBytes)
@@ -101,9 +97,7 @@ func TestNewRelayRepFromRelayForw(t *testing.T) {
s, err := NewMessage()
require.NoError(t, err)
s.AddOption(OptClientID(Duid{}))
- orm := OptRelayMsg{}
- orm.SetRelayMessage(s)
- rf.AddOption(&orm)
+ rf.AddOption(OptRelayMessage(s))
a, err := NewAdvertiseFromSolicit(s)
require.NoError(t, err)