summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkevin <kworm@missouri-telecom.com>2019-11-19 11:40:34 -0600
committerChris K <c@chrisko.ch>2019-11-20 12:30:56 -0800
commit5b35cdba62662ea5f309788a627869b5a46c8e0e (patch)
tree166c995b0e80b477c3e30ff731fd2a9af2c3c082
parentee2727953b7a5e79131fedfeb3d8b7fa64e990cb (diff)
Rename function to WithRelayAgentInfo
Fix syntax nits Simplified function as suggested by @pmazzini Signed-off-by: kevin <kworm@missouri-telecom.com>
-rw-r--r--dhcpv4/modifiers.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/dhcpv4/modifiers.go b/dhcpv4/modifiers.go
index 168b178..f076526 100644
--- a/dhcpv4/modifiers.go
+++ b/dhcpv4/modifiers.go
@@ -43,14 +43,12 @@ func WithGatewayIP(ip net.IP) Modifier {
}
}
-//WithRelayOptions copies the relay options from the request to the reply
-func WithRelayOptions(request *DHCPv4) Modifier {
+// WithRelayAgentInfo copies the relay options from the request to the reply.
+func WithRelayAgentInfo(request *DHCPv4) Modifier {
return func(d *DHCPv4) {
// If request has Relay Agent Info copy it to the reply
- if request.Options.Has(OptionRelayAgentInformation) {
- relayopt := request.Options.Get(OptionRelayAgentInformation)
- opt := OptGeneric(OptionRelayAgentInformation, relayopt)
- d.Options.Update(opt)
+ if relayOpt := request.RelayAgentInfo(); relayOpt != nil {
+ d.UpdateOption(dhcpv4.Option{Code: dhcpv4.OptionRelayAgentInformation, Value: relayOpt})
}
}
}