From bda9d2f5ec68226158387d2bc8ac8f4fde0d1a91 Mon Sep 17 00:00:00 2001 From: Andrea Barberio Date: Thu, 27 Sep 2018 14:40:14 +0100 Subject: Proper response handler in test --- dhcpv6/server_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'dhcpv6/server_test.go') 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) } } -- cgit v1.2.3