Committed by
Pavlin Radoslavov
ONOS-1153: Ignore Router Solicitation, Router Advertisement and DAD in HostLocationProvider
Change-Id: I533919fc0b04b87ca54ff0933ca87d38b664e2ef
Showing
1 changed file
with
16 additions
and
8 deletions
| ... | @@ -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; |
| ... | @@ -270,27 +272,33 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid | ... | @@ -270,27 +272,33 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid |
| 270 | new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc); | 272 | new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc); |
| 271 | providerService.hostDetected(hid, hdescr); | 273 | providerService.hostDetected(hid, hdescr); |
| 272 | 274 | ||
| 273 | - // | 275 | + // |
| 274 | - // NeighborAdvertisement and NeighborSolicitation: possible | 276 | + // NeighborAdvertisement and NeighborSolicitation: possible |
| 275 | - // new hosts, update both location and IP. | 277 | + // new hosts, update both location and IP. |
| 276 | - // | 278 | + // |
| 277 | - // IPv6: update location only | 279 | + // IPv6: update location only |
| 278 | } else if (eth.getEtherType() == Ethernet.TYPE_IPV6) { | 280 | } else if (eth.getEtherType() == Ethernet.TYPE_IPV6) { |
| 279 | IpAddress ip = null; | 281 | IpAddress ip = null; |
| 280 | IPv6 ipv6 = (IPv6) eth.getPayload(); | 282 | IPv6 ipv6 = (IPv6) eth.getPayload(); |
| 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()) { |
| 291 | - ip = sourceAddress; | 298 | + return; |
| 292 | - break; | ||
| 293 | } | 299 | } |
| 300 | + ip = sourceAddress; | ||
| 301 | + break; | ||
| 294 | } | 302 | } |
| 295 | iPkt = iPkt.getPayload(); | 303 | iPkt = iPkt.getPayload(); |
| 296 | } | 304 | } | ... | ... |
-
Please register or login to post a comment