From 8166b9a9db9b180c02622ebf3dcff01ff2b2e0a6 Mon Sep 17 00:00:00 2001 From: Andrea Barberio Date: Tue, 23 Apr 2019 23:09:44 +0100 Subject: [dhcpv6] Solicit messages derive default IAID from MAC address IAID must be set by the client. This patch generates the IAID from the MAC address of the interface. To do so, a new WithIAID modifier is added, the interface of NewSolicitWithCID now requires a hwaddr parameter, and NewAdvertiseFromSolicit copies the IA_NA option from the solicit if present. Signed-off-by: Andrea Barberio --- netboot/netconf_test.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'netboot') diff --git a/netboot/netconf_test.go b/netboot/netconf_test.go index 69d58ad..1341af4 100644 --- a/netboot/netconf_test.go +++ b/netboot/netconf_test.go @@ -7,27 +7,20 @@ import ( "github.com/insomniacslk/dhcp/dhcpv4" "github.com/insomniacslk/dhcp/dhcpv6" - "github.com/insomniacslk/dhcp/iana" "github.com/stretchr/testify/require" ) -func getAdv(modifiers ...dhcpv6.Modifier) *dhcpv6.Message { +func getAdv(advModifiers ...dhcpv6.Modifier) *dhcpv6.Message { hwaddr, err := net.ParseMAC("aa:bb:cc:dd:ee:ff") if err != nil { log.Panic(err) } - duid := dhcpv6.Duid{ - Type: dhcpv6.DUID_LLT, - HwType: iana.HWTypeEthernet, - Time: dhcpv6.GetTime(), - LinkLayerAddr: hwaddr, - } - sol, err := dhcpv6.NewSolicitWithCID(duid, modifiers...) + sol, err := dhcpv6.NewSolicit(hwaddr) if err != nil { log.Panic(err) } - d, err := dhcpv6.NewAdvertiseFromSolicit(sol, modifiers...) + d, err := dhcpv6.NewAdvertiseFromSolicit(sol, advModifiers...) if err != nil { log.Panic(err) } -- cgit v1.2.3