summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_relay_agent_information.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4/option_relay_agent_information.go')
-rw-r--r--dhcpv4/option_relay_agent_information.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/dhcpv4/option_relay_agent_information.go b/dhcpv4/option_relay_agent_information.go
index 63162a4..a338902 100644
--- a/dhcpv4/option_relay_agent_information.go
+++ b/dhcpv4/option_relay_agent_information.go
@@ -12,16 +12,16 @@ type RelayOptions struct {
var relayHumanizer = OptionHumanizer{
ValueHumanizer: func(code OptionCode, data []byte) fmt.Stringer {
- return OptionGeneric{data}
+ return raiSubOptionValue{data}
},
CodeHumanizer: func(c uint8) OptionCode {
- return GenericOptionCode(c)
+ return raiSubOptionCode(c)
},
}
// String prints the contained options using Relay Agent-specific option code parsing.
func (r RelayOptions) String() string {
- return r.Options.ToString(relayHumanizer)
+ return "\n" + r.Options.ToString(relayHumanizer)
}
// FromBytes parses relay agent options from data.
@@ -37,6 +37,14 @@ func OptRelayAgentInfo(o ...Option) Option {
return Option{Code: OptionRelayAgentInformation, Value: RelayOptions{OptionsFromList(o...)}}
}
+type raiSubOptionValue struct {
+ val []byte
+}
+
+func (rv raiSubOptionValue) String() string {
+ return fmt.Sprintf("%s (%v)", string(rv.val), rv.val)
+}
+
type raiSubOptionCode uint8
func (o raiSubOptionCode) Code() uint8 {