diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java index b12be9379d67a4bd06ec523fd43a42db62ff90ca..9c0dd1a0a405f0b010ee0b9b80d3301d28c7ca4f 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java @@ -116,7 +116,7 @@ public class LinkInfo { result = prime * result + ((firstSeenTime == null) ? 0 : firstSeenTime.hashCode()); result = prime * result + ((lastLldpReceivedTime == null) ? 0 : lastLldpReceivedTime.hashCode()); result = prime * result + ((lastBddpReceivedTime == null) ? 0 : lastBddpReceivedTime.hashCode()); - result = prime * result + ((srcPortState == null) ? 0 : lastLldpReceivedTime.hashCode()); + result = prime * result + ((srcPortState == null) ? 0 : srcPortState.hashCode()); result = prime * result + ((dstPortState == null) ? 0 : dstPortState.hashCode()); return result; } diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 462612dfb820f9f966a64f0a1deb7f00cf0e3b10..fae8fd2a071ca8b1881bd942f6ca6a36de051ef1 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -616,7 +616,7 @@ public class TopologyManager implements floodlightProvider.addHAListener(this); addRestletRoutable(); } - + protected void addRestletRoutable() { restApi.addRestletRoutable(new TopologyWebRoutable()); } @@ -624,31 +624,35 @@ public class TopologyManager implements // **************** // Internal methods // **************** - protected Command dropFilter(IOFSwitch sw, OFPacketIn pi, + /** + * If the packet-in switch port is disabled for all data traffic, then + * the packet will be dropped. Otherwise, the packet will follow the + * normal processing chain. + * @param sw + * @param pi + * @param cntx + * @return + */ + protected Command dropFilter(long sw, OFPacketIn pi, FloodlightContext cntx) { Command result = Command.CONTINUE; - Ethernet eth = - IFloodlightProviderService.bcStore. - get(cntx,IFloodlightProviderService.CONTEXT_PI_PAYLOAD); + short port = pi.getInPort(); - if (isAllowed(sw.getId(), pi.getInPort()) == false) { - if (eth.getEtherType() == Ethernet.TYPE_BDDP || - (eth.isBroadcast() == false && eth.isMulticast() == false)) { - result = Command.CONTINUE; - } else { - if (log.isTraceEnabled()) { - log.trace("Ignoring packet because of topology " + - "restriction on switch={}, port={}", - new Object[] {sw.getStringId(), - pi.getInPort()}); - } + // If the input port is not allowed for data traffic, drop everything. + // BDDP packets will not reach this stage. + if (isAllowed(sw, port) == false) { + if (log.isTraceEnabled()) { + log.trace("Ignoring packet because of topology " + + "restriction on switch={}, port={}", sw, port); result = Command.STOP; } } + + // if sufficient information is available, then drop broadcast + // packets here as well. return result; } - /** * TODO This method must be moved to a layer below forwarding * so that anyone can use it. @@ -723,9 +727,10 @@ public class TopologyManager implements TopologyInstance ti = getCurrentInstance(false); Set<Long> switches = ti.getSwitchesInOpenflowDomain(pinSwitch); - - if (switches == null) // this implies that there are no links connected to the switches + + if (switches == null) { + // indicates no links are connected to the switches switches = new HashSet<Long>(); switches.add(pinSwitch); } @@ -774,9 +779,7 @@ public class TopologyManager implements if (eth.getEtherType() == Ethernet.TYPE_BDDP) { doFloodBDDP(sw.getId(), pi, cntx); } else { - // if the packet is BDDP, then send flood it on all the external - // switch ports in the same openflow domain. - return dropFilter(sw, pi, cntx); + return dropFilter(sw.getId(), pi, cntx); } return Command.STOP; } @@ -823,7 +826,7 @@ public class TopologyManager implements update.getDst(), update.getDstPort()); updateApplied = true; } - + if (updateApplied) { appliedUpdates.add(newUpdate); }