Bugfix for gerrit #3377
NDP packets, especially NS/NA packets, are not resolved correctly in my previous commit #3377.
As a result, the IPv6 addresses of normal hosts are not recorded by HostLocationProvider.
Change-Id: Id44485902d9b593c2a8aa376e405f548774203d2
diff --git a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
index e320eda..11888fd 100644
--- a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
+++ b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
@@ -321,15 +321,16 @@
}
// Neighbor Discovery Protocol
- if (pkt instanceof ICMP6) {
+ pkt = pkt.getPayload();
+ if (pkt != null && pkt instanceof ICMP6) {
pkt = pkt.getPayload();
// RouterSolicitation, RouterAdvertisement
- if (pkt instanceof RouterAdvertisement ||
- pkt instanceof RouterSolicitation) {
+ if (pkt != null && (pkt instanceof RouterAdvertisement ||
+ pkt instanceof RouterSolicitation)) {
return;
}
- if (pkt instanceof NeighborSolicitation ||
- pkt instanceof NeighborAdvertisement) {
+ if (pkt != null && (pkt instanceof NeighborSolicitation ||
+ pkt instanceof NeighborAdvertisement)) {
// Duplicate Address Detection
if (ip.isZero()) {
return;