summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/dhcpv6relay.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/dhcpv6relay.go')
-rw-r--r--dhcpv6/dhcpv6relay.go14
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 {