diff options
Diffstat (limited to 'dhcpv4/modifiers.go')
-rw-r--r-- | dhcpv4/modifiers.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/dhcpv4/modifiers.go b/dhcpv4/modifiers.go index 431fdfd..41ad4f4 100644 --- a/dhcpv4/modifiers.go +++ b/dhcpv4/modifiers.go @@ -112,14 +112,9 @@ func WithMessageType(m MessageType) Modifier { // WithRequestedOptions adds requested options to the packet. func WithRequestedOptions(optionCodes ...OptionCode) Modifier { return func(d *DHCPv4) { - params := d.GetOneOption(OptionParameterRequestList) - if params == nil { - d.UpdateOption(OptParameterRequestList(optionCodes...)) - } else { - cl := OptionCodeList(GetParameterRequestList(d.Options)) - cl.Add(optionCodes...) - d.UpdateOption(OptParameterRequestList(cl...)) - } + cl := d.ParameterRequestList() + cl.Add(optionCodes...) + d.UpdateOption(OptParameterRequestList(cl...)) } } @@ -149,3 +144,7 @@ func WithDomainSearchList(searchList ...string) Modifier { Labels: searchList, })) } + +func WithGeneric(code OptionCode, value []byte) Modifier { + return WithOption(OptGeneric(code, value)) +} |