From 429082158fc01432c9d5e4a3de775f7a6e07a021 Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume@valadon.net>
Date: Fri, 28 Jun 2013 17:14:00 +0200
Subject: [PATCH] Use the mac address from the ICMPv6 message.

---
 scapy/layers/inet6.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
index a26c696a..a4c787ef 100644
--- a/scapy/layers/inet6.py
+++ b/scapy/layers/inet6.py
@@ -109,7 +109,10 @@ def getmacbyip6(ip6, chainCC=0):
     res = neighsol(ip6, a, iff, chainCC=chainCC)
 
     if res is not None:
-        mac = res.src
+        if ICMPv6NDOptDstLLAddr in res:
+	  mac = res[ICMPv6NDOptDstLLAddr].lladdr
+	else:
+	  mac = res.src
         conf.netcache.in6_neighbor[ip6] = mac
         return mac
 
-- 
GitLab