summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/dhcpv4.go
diff options
context:
space:
mode:
authorSean Karlage <skarlage@fb.com>2018-03-03 11:20:51 -0800
committerSean Karlage <skarlage@fb.com>2018-03-03 11:26:42 -0800
commita22cefc86285b6ba1d9879486fda11054d070b78 (patch)
tree5c77fa1b8e6ddc33b26adb32d2668229304b1502 /dhcpv4/dhcpv4.go
parent28e9aa6c820ffcb9028422b1179c1326dc76229c (diff)
Add better formatting for vendor opts
Diffstat (limited to 'dhcpv4/dhcpv4.go')
-rw-r--r--dhcpv4/dhcpv4.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go
index dc691d9..f0690b2 100644
--- a/dhcpv4/dhcpv4.go
+++ b/dhcpv4/dhcpv4.go
@@ -568,6 +568,18 @@ func (d *DHCPv4) Summary() string {
)
ret += " options=\n"
for _, opt := range d.options {
+ // Parse and display sub-options
+ if opt.Code == OptionVendorSpecificInformation {
+ ret += fmt.Sprintf(" %v ->\n", OptionCodeToString[OptionVendorSpecificInformation])
+ subopts, err := OptionsFromBytes(opt.Data)
+ if err == nil {
+ for _, subopt := range subopts {
+ ret += fmt.Sprintf(" %v\n", subopt.BSDPString())
+ }
+ continue
+ }
+ // fall-through to normal display if the above fails
+ }
ret += fmt.Sprintf(" %v\n", opt.String())
if opt.Code == OptionEnd {
break