summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_iaaddress.go
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2020-03-09 17:28:07 +0000
committerGitHub <noreply@github.com>2020-03-09 17:28:07 +0000
commit430fc1644a04631f3dfc3e0d19d0dcd0916e6e1d (patch)
tree939f25b8ae7b19a13d9b507a237ed9b116d68cf9 /dhcpv6/option_iaaddress.go
parentf22253b4fdf6b07f3ab92d457ac00c330b9f3470 (diff)
parent59c22a151d6899aedd143445953e5906b0d11574 (diff)
Merge branch 'master' into write16
Diffstat (limited to 'dhcpv6/option_iaaddress.go')
-rw-r--r--dhcpv6/option_iaaddress.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/dhcpv6/option_iaaddress.go b/dhcpv6/option_iaaddress.go
index 3f1e0ca..bb92c7a 100644
--- a/dhcpv6/option_iaaddress.go
+++ b/dhcpv6/option_iaaddress.go
@@ -8,6 +8,26 @@ import (
"github.com/u-root/u-root/pkg/uio"
)
+// AddressOptions are options valid for the IAAddress option field.
+//
+// RFC 8415 Appendix C lists only the Status Code option as valid.
+type AddressOptions struct {
+ Options
+}
+
+// Status returns the status code associated with this option.
+func (ao AddressOptions) Status() *OptStatusCode {
+ opt := ao.Options.GetOne(OptionStatusCode)
+ if opt == nil {
+ return nil
+ }
+ sc, ok := opt.(*OptStatusCode)
+ if !ok {
+ return nil
+ }
+ return sc
+}
+
// OptIAAddress represents an OptionIAAddr.
//
// This module defines the OptIAAddress structure.
@@ -16,7 +36,7 @@ type OptIAAddress struct {
IPv6Addr net.IP
PreferredLifetime time.Duration
ValidLifetime time.Duration
- Options Options
+ Options AddressOptions
}
// Code returns the option's code
@@ -39,7 +59,7 @@ func (op *OptIAAddress) ToBytes() []byte {
}
func (op *OptIAAddress) String() string {
- return fmt.Sprintf("OptIAAddress{ipv6addr=%v, preferredlifetime=%v, validlifetime=%v, options=%v}",
+ return fmt.Sprintf("IAAddress: IP=%v PreferredLifetime=%v ValidLifetime=%v Options=%v",
op.IPv6Addr, op.PreferredLifetime, op.ValidLifetime, op.Options)
}