diff options
Diffstat (limited to 'dhcpv6/modifiers.go')
-rw-r--r-- | dhcpv6/modifiers.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/dhcpv6/modifiers.go b/dhcpv6/modifiers.go index 6cd66db..cbd2231 100644 --- a/dhcpv6/modifiers.go +++ b/dhcpv6/modifiers.go @@ -62,3 +62,19 @@ func WithArchType(at iana.ArchType) Modifier { return d } } + +// WithRequestedOptions adds requested options to the packet +func WithRequestedOptions(optionCodes ...OptionCode) Modifier { + return func(d DHCPv6) DHCPv6 { + opt := d.GetOneOption(OptionORO) + if opt == nil { + opt = &OptRequestedOption{} + } + oro := opt.(*OptRequestedOption) + for _, optionCode := range optionCodes { + oro.AddRequestedOption(optionCode) + } + d.UpdateOption(oro) + return d + } +} |