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;
......@@ -270,27 +272,33 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc);
providerService.hostDetected(hid, hdescr);
//
// NeighborAdvertisement and NeighborSolicitation: possible
// new hosts, update both location and IP.
//
// IPv6: update location only
//
// NeighborAdvertisement and NeighborSolicitation: possible
// new hosts, update both location and IP.
//
// IPv6: update location only
} else if (eth.getEtherType() == Ethernet.TYPE_IPV6) {
IpAddress ip = null;
IPv6 ipv6 = (IPv6) eth.getPayload();
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()) {
ip = sourceAddress;
break;
if (sourceAddress.isZero()) {
return;
}
ip = sourceAddress;
break;
}
iPkt = iPkt.getPayload();
}
......