From 63954f993bd3cc56f2999e34c67e75fb5be7ed0f Mon Sep 17 00:00:00 2001 From: Mikma Date: Tue, 26 Oct 2021 00:09:14 +0200 Subject: dhcpv6: fix and improve IA_TA (#449) Fix typo in MessageOptions.IATA(). Add iaid argument to WithIATA() to allow it to be set easily in line with WithIAPD(). Add a test for WithIATA(), Signed-off-by: Mikael Magnusson Co-authored-by: Mikael Magnusson Co-authored-by: Pablo Mazzini --- dhcpv6/modifiers.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dhcpv6/modifiers.go') diff --git a/dhcpv6/modifiers.go b/dhcpv6/modifiers.go index 8c708d9..1d8c49f 100644 --- a/dhcpv6/modifiers.go +++ b/dhcpv6/modifiers.go @@ -91,15 +91,17 @@ func WithIAID(iaid [4]byte) Modifier { } } -// WithIATA adds or updates an OptIANA option with the provided IAAddress -// options -func WithIATA(addrs ...OptIAAddress) Modifier { +// WithIATA adds or updates an OptIATA option with the provided IAID, +// and IAAddress options +func WithIATA(iaid [4]byte, addrs ...OptIAAddress) Modifier { return func(d DHCPv6) { if msg, ok := d.(*Message); ok { iata := msg.Options.OneIATA() if iata == nil { iata = &OptIATA{} } + copy(iata.IaId[:], iaid[:]) + for _, addr := range addrs { iata.Options.Add(&addr) } -- cgit v1.2.3