diff options
author | Andrea Barberio <insomniac@slackware.it> | 2018-09-27 14:40:14 +0100 |
---|---|---|
committer | Andrea Barberio <insomniac@slackware.it> | 2018-09-27 14:40:14 +0100 |
commit | bda9d2f5ec68226158387d2bc8ac8f4fde0d1a91 (patch) | |
tree | f2d97be0a75bd57695ae3d185ef91565d97a9e78 /dhcpv6/server_test.go | |
parent | 6f2077f56ae6cbf8a8f69e49049b1a697ff62106 (diff) |
Proper response handler in test
Diffstat (limited to 'dhcpv6/server_test.go')
-rw-r--r-- | dhcpv6/server_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dhcpv6/server_test.go b/dhcpv6/server_test.go index 4fc919b..066fe3a 100644 --- a/dhcpv6/server_test.go +++ b/dhcpv6/server_test.go @@ -59,8 +59,12 @@ func TestNewServer(t *testing.T) { func TestServerActivateAndServe(t *testing.T) { handler := func(conn net.PacketConn, peer net.Addr, m DHCPv6) { - log.Printf("MESSAGE from %s, reply with %v", peer, m.ToBytes()) - if _, err := conn.WriteTo(m.ToBytes(), peer); err != nil { + adv, err := NewAdvertiseFromSolicit(m) + if err != nil { + log.Printf("NewAdvertiseFromSolicit failed: %v", err) + return + } + if _, err := conn.WriteTo(adv.ToBytes(), peer); err != nil { log.Printf("Cannot reply to client: %v", err) } } |