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; ...@@ -37,6 +37,8 @@ import org.onlab.packet.IpAddress;
37 import org.onlab.packet.VlanId; 37 import org.onlab.packet.VlanId;
38 import org.onlab.packet.ndp.NeighborAdvertisement; 38 import org.onlab.packet.ndp.NeighborAdvertisement;
39 import org.onlab.packet.ndp.NeighborSolicitation; 39 import org.onlab.packet.ndp.NeighborSolicitation;
40 +import org.onlab.packet.ndp.RouterAdvertisement;
41 +import org.onlab.packet.ndp.RouterSolicitation;
40 import org.onosproject.cfg.ComponentConfigService; 42 import org.onosproject.cfg.ComponentConfigService;
41 import org.onosproject.core.ApplicationId; 43 import org.onosproject.core.ApplicationId;
42 import org.onosproject.core.CoreService; 44 import org.onosproject.core.CoreService;
...@@ -281,17 +283,23 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid ...@@ -281,17 +283,23 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
281 283
282 IPacket iPkt = ipv6; 284 IPacket iPkt = ipv6;
283 while (iPkt != null) { 285 while (iPkt != null) {
286 + // Ignore Router Solicitation and Advertisement
287 + if (iPkt instanceof RouterAdvertisement ||
288 + iPkt instanceof RouterSolicitation) {
289 + return;
290 + }
284 if (iPkt instanceof NeighborAdvertisement || 291 if (iPkt instanceof NeighborAdvertisement ||
285 iPkt instanceof NeighborSolicitation) { 292 iPkt instanceof NeighborSolicitation) {
286 IpAddress sourceAddress = 293 IpAddress sourceAddress =
287 IpAddress.valueOf(IpAddress.Version.INET6, 294 IpAddress.valueOf(IpAddress.Version.INET6,
288 ipv6.getSourceAddress()); 295 ipv6.getSourceAddress());
289 // Ignore DAD packets, in which source address is zero 296 // Ignore DAD packets, in which source address is zero
290 - if (!sourceAddress.isZero()) { 297 + if (sourceAddress.isZero()) {
298 + return;
299 + }
291 ip = sourceAddress; 300 ip = sourceAddress;
292 break; 301 break;
293 } 302 }
294 - }
295 iPkt = iPkt.getPayload(); 303 iPkt = iPkt.getPayload();
296 } 304 }
297 HostDescription hdescr = (ip == null) ? 305 HostDescription hdescr = (ip == null) ?
......