diff options
author | Tom McPhail <tom.mcphail@icloud.com> | 2020-06-01 23:17:56 +1000 |
---|---|---|
committer | Tom McPhail <tom.mcphail@icloud.com> | 2020-06-01 23:40:22 +1000 |
commit | 09f6357e9117743012d95388156bc2f6ab606116 (patch) | |
tree | 573440499f10dff5dddf69b35ee6f8c5682eb84a /dhcpv6/dhcpv6relay.go | |
parent | ed3125c2efe7026894d9ecf1c41d213d6c1f2010 (diff) |
Add Client Link-Layer Address option for RFC 6939 support.
Signed-off-by: Tom McPhail <tom.mcphail@icloud.com>
Diffstat (limited to 'dhcpv6/dhcpv6relay.go')
-rw-r--r-- | dhcpv6/dhcpv6relay.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6relay.go b/dhcpv6/dhcpv6relay.go index 9c08e00..26d6ed4 100644 --- a/dhcpv6/dhcpv6relay.go +++ b/dhcpv6/dhcpv6relay.go @@ -5,6 +5,7 @@ import ( "fmt" "net" + "github.com/insomniacslk/dhcp/iana" "github.com/u-root/u-root/pkg/uio" ) @@ -54,6 +55,19 @@ func (ro RelayOptions) RemoteID() *OptRemoteID { return nil } +// ClientLinkLayerAddress returns the Hardware Type and +// Link Layer Address of the requesting client in this relay message. +func (ro RelayOptions) ClientLinkLayerAddress() (iana.HWType, net.HardwareAddr) { + opt := ro.Options.GetOne(OptionClientLinkLayerAddr) + if opt == nil { + return 0, nil + } + if lla, ok := opt.(*optClientLinkLayerAddress); ok { + return lla.LinkLayerType, lla.LinkLayerAddress + } + return 0, nil +} + // RelayMessage is a DHCPv6 relay agent message as defined by RFC 3315 Section // 7. type RelayMessage struct { |