Charles M.C. Chan
Committed by Gerrit Code Review

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
...@@ -321,15 +321,16 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid ...@@ -321,15 +321,16 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
321 } 321 }
322 322
323 // Neighbor Discovery Protocol 323 // Neighbor Discovery Protocol
324 - if (pkt instanceof ICMP6) { 324 + pkt = pkt.getPayload();
325 + if (pkt != null && pkt instanceof ICMP6) {
325 pkt = pkt.getPayload(); 326 pkt = pkt.getPayload();
326 // RouterSolicitation, RouterAdvertisement 327 // RouterSolicitation, RouterAdvertisement
327 - if (pkt instanceof RouterAdvertisement || 328 + if (pkt != null && (pkt instanceof RouterAdvertisement ||
328 - pkt instanceof RouterSolicitation) { 329 + pkt instanceof RouterSolicitation)) {
329 return; 330 return;
330 } 331 }
331 - if (pkt instanceof NeighborSolicitation || 332 + if (pkt != null && (pkt instanceof NeighborSolicitation ||
332 - pkt instanceof NeighborAdvertisement) { 333 + pkt instanceof NeighborAdvertisement)) {
333 // Duplicate Address Detection 334 // Duplicate Address Detection
334 if (ip.isZero()) { 335 if (ip.isZero()) {
335 return; 336 return;
......