diff options
Diffstat (limited to 'dhcpv4/modifiers.go')
-rw-r--r-- | dhcpv4/modifiers.go | 10 |
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}) } } } |