summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2020-02-04 13:09:43 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commit3bf2e89230d11ddbee88ae5146016c175fbdf0ae (patch)
tree21e52c5bb2ee2c792ba539e725ae7ba38a55345c
parent72e14d6762cd895f00fd5c04fec8a16df521b65f (diff)
v6: merge multiple OptionOROs
Signed-off-by: Chris Koch <chrisko@google.com>
-rw-r--r--dhcpv6/dhcpv6message.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go
index 745a837..3963f39 100644
--- a/dhcpv6/dhcpv6message.go
+++ b/dhcpv6/dhcpv6message.go
@@ -81,15 +81,22 @@ func (mo MessageOptions) Status() *OptStatusCode {
// RequestedOptions returns the Options Requested Option.
func (mo MessageOptions) RequestedOptions() OptionCodes {
- opt := mo.Options.GetOne(OptionORO)
- if opt == nil {
+ // Technically, RFC 8415 states that ORO may only appear once in the
+ // area of a DHCP message. However, some proprietary clients have been
+ // observed sending more than one OptionORO.
+ //
+ // So we merge them.
+ opt := mo.Options.Get(OptionORO)
+ if len(opt) == 0 {
return nil
}
- oro, ok := opt.(*optRequestedOption)
- if !ok {
- return nil
+ var oc OptionCodes
+ for _, o := range opt {
+ if oro, ok := o.(*optRequestedOption); ok {
+ oc = append(oc, oro.OptionCodes...)
+ }
}
- return oro.OptionCodes
+ return oc
}
// DNS returns the DNS Recursive Name Server option as defined by RFC 3646.