Committed by
Gerrit Code Review
ONOS-2432 Fixed blackhole npe by only acting on src and dst hosts that are not null
Change-Id: Iae587a8b873b0d697bb6d723be2afafd9bb56de4
Showing
1 changed file
with
8 additions
and
3 deletions
... | @@ -698,20 +698,25 @@ public class ReactiveForwarding { | ... | @@ -698,20 +698,25 @@ public class ReactiveForwarding { |
698 | 698 | ||
699 | for (SrcDstPair sd : pairs) { | 699 | for (SrcDstPair sd : pairs) { |
700 | // get the edge deviceID for the src host | 700 | // get the edge deviceID for the src host |
701 | - DeviceId srcId = hostService.getHost(HostId.hostId(sd.src)).location().deviceId(); | 701 | + Host srcHost = hostService.getHost(HostId.hostId(sd.src)); |
702 | - DeviceId dstId = hostService.getHost(HostId.hostId(sd.dst)).location().deviceId(); | 702 | + Host dstHost = hostService.getHost(HostId.hostId(sd.dst)); |
703 | + if (srcHost != null && dstHost != null) { | ||
704 | + DeviceId srcId = srcHost.location().deviceId(); | ||
705 | + DeviceId dstId = dstHost.location().deviceId(); | ||
703 | log.trace("SRC ID is " + srcId + ", DST ID is " + dstId); | 706 | log.trace("SRC ID is " + srcId + ", DST ID is " + dstId); |
704 | 707 | ||
705 | cleanFlowRules(sd, egress.deviceId()); | 708 | cleanFlowRules(sd, egress.deviceId()); |
706 | 709 | ||
707 | Set<Path> shortestPaths = srcPaths.get(srcId); | 710 | Set<Path> shortestPaths = srcPaths.get(srcId); |
708 | if (shortestPaths == null) { | 711 | if (shortestPaths == null) { |
709 | - shortestPaths = topologyService.getPaths(topologyService.currentTopology(), egress.deviceId(), srcId); | 712 | + shortestPaths = topologyService.getPaths(topologyService.currentTopology(), |
713 | + egress.deviceId(), srcId); | ||
710 | srcPaths.put(srcId, shortestPaths); | 714 | srcPaths.put(srcId, shortestPaths); |
711 | } | 715 | } |
712 | backTrackBadNodes(shortestPaths, dstId, sd); | 716 | backTrackBadNodes(shortestPaths, dstId, sd); |
713 | } | 717 | } |
714 | } | 718 | } |
719 | + } | ||
715 | 720 | ||
716 | // Backtracks from link down event to remove flows that lead to blackhole | 721 | // Backtracks from link down event to remove flows that lead to blackhole |
717 | private void backTrackBadNodes(Set<Path> shortestPaths, DeviceId dstId, SrcDstPair sd) { | 722 | private void backTrackBadNodes(Set<Path> shortestPaths, DeviceId dstId, SrcDstPair sd) { | ... | ... |
-
Please register or login to post a comment