summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/options.go')
-rw-r--r--dhcpv6/options.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/dhcpv6/options.go b/dhcpv6/options.go
index 3ee5dad..d64d1d9 100644
--- a/dhcpv6/options.go
+++ b/dhcpv6/options.go
@@ -120,11 +120,15 @@ func ParseOption(dataStart []byte) (Option, error) {
func OptionsFromBytes(data []byte) ([]Option, error) {
// Parse a sequence of bytes until the end and build a list of options from
// it. Returns an error if any invalid option or length is found.
+ options := make([]Option, 0, 10)
+ if len(data) == 0 {
+ // no options, no party
+ return options, nil
+ }
if len(data) < 4 {
// cannot be shorter than option code (2 bytes) + length (2 bytes)
return nil, fmt.Errorf("Invalid options: shorter than 4 bytes")
}
- options := make([]Option, 0, 10)
idx := 0
for {
if idx == len(data) {