From 9eeb48258741aa8a72d95ec3e097deb281a73dcf Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 26 Dec 2018 11:51:21 +0000 Subject: [PATCH] Use ICMPv6 NDP target instead of source address when populating peermacs --- src/yggdrasil/icmpv6.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/icmpv6.go b/src/yggdrasil/icmpv6.go index baae3ab4..a8d4e6de 100644 --- a/src/yggdrasil/icmpv6.go +++ b/src/yggdrasil/icmpv6.go @@ -175,10 +175,13 @@ func (i *icmpv6) parse_packet_tun(datain []byte, datamac *[]byte) ([]byte, error case ipv6.ICMPTypeNeighborAdvertisement: if datamac != nil { var addr address.Address + var target address.Address var mac macAddress copy(addr[:], ipv6Header.Src[:]) + copy(target[:], datain[48:64]) copy(mac[:], (*datamac)[:]) - neighbor := i.peermacs[addr] + // i.tun.core.log.Println("Learning peer MAC", mac, "for", target) + neighbor := i.peermacs[target] neighbor.mac = mac neighbor.learned = true neighbor.lastadvertisement = time.Now()