summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/modifiers_test.go
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2020-03-04 21:43:33 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2020-03-10 11:16:03 +0100
commit6875c928a140faa34d2afff9a360115e0dda4914 (patch)
tree8d3c6dbc3ed8c99413597006ea5b4d04abf0bbcf /dhcpv6/modifiers_test.go
parent94e5923c9c44b0e829d793508e6772e6a96feb47 (diff)
dhcpv6: add IA_PD to request from advertise
Add the IA_PD option to the request from the advertise if present. Add WithIAPD() as modifier and test. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'dhcpv6/modifiers_test.go')
-rw-r--r--dhcpv6/modifiers_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/dhcpv6/modifiers_test.go b/dhcpv6/modifiers_test.go
index c240067..bd328a3 100644
--- a/dhcpv6/modifiers_test.go
+++ b/dhcpv6/modifiers_test.go
@@ -107,3 +107,17 @@ func TestWithDHCP4oDHCP6Server(t *testing.T) {
require.Equal(t, net.ParseIP("fe80::2"), opt.DHCP4oDHCP6Servers[1])
require.NotEqual(t, net.ParseIP("fe80::1"), opt.DHCP4oDHCP6Servers[1])
}
+
+func TestWithIAPD(t *testing.T) {
+ var d Message
+ prefix := OptIAPrefix{
+ PreferredLifetime: 3600,
+ ValidLifetime: 5200,
+ }
+ prefix.SetPrefixLength(48)
+ prefix.SetIPv6Prefix(net.ParseIP("2001:DB8:7689::"))
+ WithIAPD([4]byte{1, 2, 3, 4}, prefix)(&d)
+ opt := d.Options.IAPD()
+ require.Equal(t, 1, len(opt))
+ require.Equal(t, OptionIAPD, opt[0].Code())
+}