diff options
author | Dennis Marttinen <twelho@welho.tech> | 2022-07-14 14:52:58 +0300 |
---|---|---|
committer | Dennis Marttinen <twelho@welho.tech> | 2022-07-15 22:02:52 +0300 |
commit | 0405526172c87e4fc75325c9a195834a8fb4ba94 (patch) | |
tree | bdee0c60c57077e38c0d6c89dd4b78eb7d7e9edb /dhcpv4/dhcpv4.go | |
parent | 1ca156eafb9f20f7884eddc2cf610bade5dfb560 (diff) |
dhcpv4: enable deletion of options and add modifier for it
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
Diffstat (limited to 'dhcpv4/dhcpv4.go')
-rw-r--r-- | dhcpv4/dhcpv4.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go index b894fbb..900bb22 100644 --- a/dhcpv4/dhcpv4.go +++ b/dhcpv4/dhcpv4.go @@ -382,6 +382,13 @@ func (d *DHCPv4) GetOneOption(code OptionCode) []byte { return d.Options.Get(code) } +// DeleteOption deletes an existing option with the given option code. +func (d *DHCPv4) DeleteOption(code OptionCode) { + if d.Options != nil { + d.Options.Del(code) + } +} + // UpdateOption replaces an existing option with the same option code with the // given one, adding it if not already present. func (d *DHCPv4) UpdateOption(opt Option) { |