summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/dhcpv4.go
diff options
context:
space:
mode:
authorDennis Marttinen <twelho@welho.tech>2022-07-14 14:52:58 +0300
committerDennis Marttinen <twelho@welho.tech>2022-07-15 22:02:52 +0300
commit0405526172c87e4fc75325c9a195834a8fb4ba94 (patch)
treebdee0c60c57077e38c0d6c89dd4b78eb7d7e9edb /dhcpv4/dhcpv4.go
parent1ca156eafb9f20f7884eddc2cf610bade5dfb560 (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.go7
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) {