diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2020-08-13 09:16:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 09:16:05 +0100 |
commit | e10aec901335bf3bfea7ee5faf22cf0256f99420 (patch) | |
tree | 44ae94901045f8aad28b02995fbf53b5f31c9c25 /dhcpv6 | |
parent | 3f14f7f8bd9cd69eb47abcc82768498a03d1e74a (diff) | |
parent | 046c7ae86423d114299a0c46af5c1a1df581905f (diff) |
Merge pull request #392 from pmazzini/mac
ExtractMAC: use option 79
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/iputils.go | 7 |
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() |