Charles M.C. Chan
Committed by Pavlin Radoslavov

ONOS-1153: Ignore Router Solicitation, Router Advertisement and DAD in HostLocationProvider

Change-Id: I533919fc0b04b87ca54ff0933ca87d38b664e2ef
......@@ -37,6 +37,8 @@ import org.onlab.packet.IpAddress;
import org.onlab.packet.VlanId;
import org.onlab.packet.ndp.NeighborAdvertisement;
import org.onlab.packet.ndp.NeighborSolicitation;
import org.onlab.packet.ndp.RouterAdvertisement;
import org.onlab.packet.ndp.RouterSolicitation;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
......@@ -281,17 +283,23 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
IPacket iPkt = ipv6;
while (iPkt != null) {
// Ignore Router Solicitation and Advertisement
if (iPkt instanceof RouterAdvertisement ||
iPkt instanceof RouterSolicitation) {
return;
}
if (iPkt instanceof NeighborAdvertisement ||
iPkt instanceof NeighborSolicitation) {
IpAddress sourceAddress =
IpAddress.valueOf(IpAddress.Version.INET6,
ipv6.getSourceAddress());
// Ignore DAD packets, in which source address is zero
if (!sourceAddress.isZero()) {
if (sourceAddress.isZero()) {
return;
}
ip = sourceAddress;
break;
}
}
iPkt = iPkt.getPayload();
}
HostDescription hdescr = (ip == null) ?
......