summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/modifiers.go
diff options
context:
space:
mode:
authorMikma <mikma@users.noreply.github.com>2021-10-26 00:09:14 +0200
committerGitHub <noreply@github.com>2021-10-25 23:09:14 +0100
commit63954f993bd3cc56f2999e34c67e75fb5be7ed0f (patch)
treef953c43587d8bb7deb4117a931659077ca60faf6 /dhcpv6/modifiers.go
parentb28ed3e9daf60f867fe8475745add4461356eaad (diff)
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 <mikma@users.sourceforge.net> Co-authored-by: Mikael Magnusson <mikma@users.sourceforge.net> Co-authored-by: Pablo Mazzini <pmazzini@gmail.com>
Diffstat (limited to 'dhcpv6/modifiers.go')
-rw-r--r--dhcpv6/modifiers.go8
1 files changed, 5 insertions, 3 deletions
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)
}