summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv6/iputils.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/dhcpv6/iputils.go b/dhcpv6/iputils.go
index 9c18da2..d2cac47 100644
--- a/dhcpv6/iputils.go
+++ b/dhcpv6/iputils.go
@@ -74,8 +74,11 @@ func ExtractMAC(packet DHCPv6) (net.HardwareAddr, error) {
if err != nil {
return nil, err
}
- ip := inner.(*RelayMessage).PeerAddr
- if mac, err := GetMacAddressFromEUI64(ip); err == nil {
+ relay := inner.(*RelayMessage)
+ if _, mac := relay.Options.ClientLinkLayerAddress(); mac != nil {
+ return mac, nil
+ }
+ if mac, err := GetMacAddressFromEUI64(relay.PeerAddr); err == nil {
return mac, nil
}
msg, err = msg.(*RelayMessage).GetInnerMessage()